#include<stdio.h>
#include<math.h>
int main() {
int choice;
float a,b,c;
printf(“…Welcome to the Calculator System…\n”);
while(1){
c=0;
printf(“\n”);
printf(“1.Add 2.Subtruct 3.Multiplication\n”);
printf(“4.Division 5.Square root 6.Power\n7.Exit\n”);
printf(“Enter your choice : \n”);
scanf(“%d”,&choice);
if(choice==1){
printf(“\nEnter two values to Add(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a+b;
printf(“\nResult : %.2f + %.2f = %.2f\n”,a,b,c);
}
else if(choice==2){
printf(“\nEnter two values to Subtruct(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a-b;
printf(“\nResult : %.2f – %.2f = %.2f\n”,a,b,c);
}
else if(choice==3){
printf(“\nEnter two values for Multiplication(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a*b;
printf(“\nResult : %.2f * %.2f = %.2f\n”,a,b,c);
}
else if(choice==4){
printf(“\nEnter two values for Division(separate values by space): “);
scanf(“%f %f”,&a,&b);
if(b==0){
printf(“\nCan’t devide by ZERO\n”);
}
else {
c=a/b;
printf(“\nResult : %.2f / %.2f = %.2f\n”,a,b,c);
}
}
else if(choice==5){
printf(“\nEnter the value to calculate Square root: “);
scanf(“%f”,&a);
c=sqrt(a);
printf(“\nResult : The square root of %.2f is %.2f\n”,a,c);
}
else if(choice==6){
printf(“\nEnter two values 1st one is the number 2nd one is the power : “);
scanf(“%f %f”,&a,&b);
c=pow(a,b);
printf(“\nResult : %.2f to the power %.2f = %.2f\n”,a,b,c);
}
else {
break;
}
}
return 0;
}
#include<math.h>
int main() {
int choice;
float a,b,c;
printf(“…Welcome to the Calculator System…\n”);
while(1){
c=0;
printf(“\n”);
printf(“1.Add 2.Subtruct 3.Multiplication\n”);
printf(“4.Division 5.Square root 6.Power\n7.Exit\n”);
printf(“Enter your choice : \n”);
scanf(“%d”,&choice);
if(choice==1){
printf(“\nEnter two values to Add(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a+b;
printf(“\nResult : %.2f + %.2f = %.2f\n”,a,b,c);
}
else if(choice==2){
printf(“\nEnter two values to Subtruct(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a-b;
printf(“\nResult : %.2f – %.2f = %.2f\n”,a,b,c);
}
else if(choice==3){
printf(“\nEnter two values for Multiplication(separate values by space): “);
scanf(“%f %f”,&a,&b);
c=a*b;
printf(“\nResult : %.2f * %.2f = %.2f\n”,a,b,c);
}
else if(choice==4){
printf(“\nEnter two values for Division(separate values by space): “);
scanf(“%f %f”,&a,&b);
if(b==0){
printf(“\nCan’t devide by ZERO\n”);
}
else {
c=a/b;
printf(“\nResult : %.2f / %.2f = %.2f\n”,a,b,c);
}
}
else if(choice==5){
printf(“\nEnter the value to calculate Square root: “);
scanf(“%f”,&a);
c=sqrt(a);
printf(“\nResult : The square root of %.2f is %.2f\n”,a,c);
}
else if(choice==6){
printf(“\nEnter two values 1st one is the number 2nd one is the power : “);
scanf(“%f %f”,&a,&b);
c=pow(a,b);
printf(“\nResult : %.2f to the power %.2f = %.2f\n”,a,b,c);
}
else {
break;
}
}
return 0;
}