C Program For Addition,Substration,Multiplication And Division


Posted Date:     Total Responses: 0    Posted By: rajesh kale   Member Level: Silver   Points/Cash: 3   


C Program For Addition,Substration,Multiplication And Division




#include
#include
void main()
{
int I;
float A,B,C,D;
clrscr();
printf("\t\t PROGRAM FOR CALCULATOR \n ");
printf("\n ENTER TWO NUMBERS : - ");
scanf("%f%f", &A,&B);
printf("\n ENTER YOUR CHOICE : - \n);
printf("\n 1. ADDITION \n");
printf("\n 2. SUBSTRACTION \n ");
printf("\n 3. MULTIPLICATION \n");
printf("\n 4. DIVISION \n");
printf("\n 0. EXIT \n");
printf("\n ENTER YOUR CHOICE : - ");
SCANF("%d",&I);
if(I==0)
{
exit(0);
}
switch(I)
{
case 1:
{
C= A+B;
printf("\n THE ADDITION IS : %f",C);
break;
}
case 2:
{
C=A-B;
printf("\n THE SUBSTRACTION IS : %f", C);
break;
}
case 3:
{
C=A*B;
printf("\n THE MULTIPLICATION : %f", C);
break;
}
case 4:
{
if(B==0)
{
printf("\n THE DIVISION IS : - 'INFINITY'");
break;
}
D=A/B;
printf("\n THE DIVISION IS : - %f", D);
break;
}
default:
{
printf("\n WRONG CHOICE");
}
}
getch();
}


Project Feedbacks


No feedbacks found. Be the first to respond...

Post Feedback
You must Sign In to post a feedback.
Next Project: C Language Program For Selection Sort
Previous Project: C Language Program For Multiplication Of Two Matrices

Return to Project Index

Post New Project


Related Projects

Awards & Gifts
Active Members
TodayLast 7 Daysmore...

ISC Technologies, Kochi - India. Copyright © All Rights Reserved.