Simple Calculator and TEMPERATURE CONVERTER program in C.
Solution:/* SIMPLE CALCULATOR AND TEMPERATURE CONVERTER */
#include<stdio.h>
int main()
{
char fx;
printf("What do You want??\n\n**Press S for Using Simple calculater\n\n**Or Press T for using Temperature converter\n");
scanf("%c",&fx);
printf("\n\n");
if(fx=='s'||fx=='S')
{
int a,b;
printf("Enter an integer number: ");
scanf("%d",&a);
printf("Enter another integer number: ");
scanf("%d",&b);
printf("\nSum is : %d\n",a+b);
printf("\nSubstance is: %d \n",a-b);
printf("\nMultipul is : %d\n",a*b);
printf("\nDivision is : %d\n",a/b);
printf("\nMudulas is : %d\n",a%b);
}
else if(fx=='t' ||fx=='T')
{
char enter,ch;
printf("\nPress C for Celcise to Farenhite\nand Press F for Farenhite to Celcise\n");
scanf("%c %c",&enter,&ch);
if(ch=='c'|| ch=='C')
{
float celcise,farenhite;
printf("Enter Celcise scale rading: ");
scanf("%f",&celcise);
farenhite=(1.8*celcise)+32;
printf("\nFarenhite rading is : %f\n",farenhite);
}
else if(fx=='f'||fx=='F')
{
float celcise1,farenhite1;
printf("Enter Farenhite scale rading: ");
scanf("%f",&farenhite1);
celcise1=.556*(farenhite1-32);
printf("\nCelcise scale is: %f\n",celcise1);
}
}
getch();
}