SP 4
SP 4
STRUCTURED PROGRAMMING
STUDENT'S Atharva Gaikwad ROLL 24101B0082 DATE:
NAME: NO. 01-12-24
BRANCH: Information Technology DIV: B EXP NO:
4
PROBLEM
STATEMENT WAP to do arithmetic operations till user enters Zero(0)
CODE: #include<stdio.h>
int main()
float a,b,y;
int c;
scanf("%f",&a);
scanf("%f",&b);
printf("Choose operation:\n");
printf("0.Exit\n");
printf("1. Add\n");
printf("2. Subtract\n");
printf("3. Multiply\n");
printf("4. Divide\n");
while(1)
if (c== 0)
break;
switch(c)
case 1:
y = a + b;
printf("Addition : %f \n",y);
break;
case 2 :
y = a-b;
printf("Subtraction : %f\n",y);
break;
case 3 :
y = a*b;
printf("Multiplication : %f\n",y);
break;
case 4 :
y = a/b;
printf("Division : %f\n",y);
break;
default:
printf("\n");
printf("Program ended.\n");
return 0;
}
OUTPUT: