Calculator Program
Hello guys, in this post I am going to give you a practice program which is an ATM program it is very simple which not include any graphics.
so let us move on to the program.
Source code =
#include<stdio.h>
#include<conio.h>
void main()
{
float ch,ad1,ad2,sb1,sb2,mt1,mt2,di1,di2;
printf("\n\t\nplease enter what you want to do in calculator");
printf("\n\t1.Addition");
printf("\n\t2.Subtraction");
printf("\n\t3.Multiplication");
printf("\n\t4.Division");
printf("\n\n\tEnter your Choose= ");
scanf("%f",&ch);
if (ch==1)
{
printf("\n\tenter the first digit= ");
scanf("%f",&ad1);
printf("\n\tenter the second digit= ");
scanf("%f",&ad2);
float ans1=ad1+ad2;
printf("\n\tAnswer= %f",ans1);
printf("\n\tAddition is done");
}else if (ch==2)
{
printf("\n\tenter the first digit= ");
scanf("%f",&sb1);
printf("\n\tenter the second digit= ");
scanf("%f",&sb2);
float ans2=sb1-sb2;
printf("\n\tAnswer= %f",ans2);
printf("\n\tSubtraction is done");
}else if (ch==3)
{
printf("\n\tenter the first digit= ");
scanf("%f",&mt1);
printf("\n\tenter the second digit= ");
scanf("%f",&mt2);
float ans3=mt1*mt2;
printf("\n\tAnswer= %f",ans3);
printf("\n\tMultiplication is done");
}else if (ch==4)
{
printf("\n\tenter the first digit= ");
scanf("%f",&di1);
printf("\n\tenter the second digit= ");
scanf("%f",&di2);
float ans4=di1/di2;
printf("\n\tAnswer= %f",ans4);
printf("\n\tDivision is done");
}
}
my youtube video for more information =
No comments:
Post a Comment