Calculator Using C Programming

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
int a;
printf("options are :\n 1.add\t 2.sub\t 3.mul\t 4.div\t 5.mod\t");
scanf("%d",&a);
if(a==1){
    int b,c,d;
    printf("enter  any two number");
    scanf("%d%d",&b,&c);
    d=b+c;
    printf("the add result is %d",d);
}
else if(a==2){
        int e,f,g;
        printf("please enter any two number");
        scanf("%d%d",&e,&f);
        g=e-f;
        printf("the sub result is %d",g);
}
else if(a==3){
    int h,i,j;
    printf("enter any two number");
    scanf("%d%d",&h,&i);
    j=h/i;
    printf("the div result is %d",j);
}
else if(a==4)
{
    int k,l,m;
    printf("enter any two number");
    scanf("%d%d",&k,&l);
    m=k*l;
    printf("the mul result is %d",m);
}
else if(a==5)
{
    int n,o,p;
    printf("enter any two number");
    scanf("%d%d",&n,&o);
    p=n%o;
    printf("the mod result is %d",p);
}
else{
    printf("The input you provided is wrong");

}
}

Comments

Popular posts from this blog

Money Maker