First Program
First Program
h>
#include <stdlib.h>
#include <time.h>
#include <string.h>
// color
int main() {
float a, b, c, d, result;
char operation;
// Introduction of me
while (1) {
if (scanf("%d", &choice) != 1) {
continue;
switch (choice) {
case 1:
if (scanf("%d", &num) != 1) {
break;
if (num % 2 == 0) {
} else {
break;
case 2:
printf(YELLOW "Enter expression (e.g., 2 + 3): " RESET);
break;//?
switch (operation) {
case '/':
if (b == 0) {
break;
result = a / b;
break;
break;
case 3:
break;
}
result = (a + b) * (c - d);
break;
case 4:
if (scanf("%d", &year) != 1) {
break;
if (age >= 0) {
} else {
printf(RED "Invalid birth year. Please enter a valid input\n" RESET); // Fixed to here
break;
int counter = 0;
do {
counter++;
if (counter == 3) {
continue;
}
if (counter == 5) {
break;
break;
} // was thinking of making the user give the value of the loop then i thuoght what if the user kept
on pressing 999999 so no .
case 6:
return 0;
default:
//my info is at the begining of the code .the main struggles would revolve around understanding the
subtle detials of C language, especially regarding scanf, switch statements, input handling, and loop
control. It would take practice and experimentation and consulting resources like textbooks, online
tutorials, and asking questions to overcomw these challenges
return 0;