Calculater using c language.

                       Calculater using c language


This blog introduce you to concept of making simple calculater using c language.It is the simple code
that everyone should know.






https://programminghub1999.blogspot.com/2018/12/calculater-using-c-language.html




          Following method has used inside the programme

  1. Take two input from user for performing the operation.
  2. Display the message for which operation user want to operate on input.
  3. Use conditional operation(switch statement) for operation.
  4. Take the input from user and perform the operation accordingly.


                 
                                                  Simple calculater




#include<stdio.h>
#include<conio.h>
void main()
{
   int a,b,result,op;
printf("Enter first number\n");
scanf("%d",&a);
printf("Enter second number\n");
scanf("%d",&b);
printf("Which operation you want to operate\n");
printf("1.add, 2.subs,3.dic,4.multi\n");
printf("Enter your choice\n");
scanf("%d",&op);
switch(op)
{
   case 1:result=a+b;
              printf("Result is %d",result);
              break;
   case 2:result=a-b;
              printf("Result is %d",result);
              break;
   case 3:result=a/b;
             printf("Result is %d",result);
             break;
  case 4:result=a*b;
            printf("Result is %d",result);
            break;
 default:printf("Enter valid option\n");
}

getch();
}



Calculater using c language. Calculater using c language. Reviewed by Deepak kumar soni on December 19, 2018 Rating: 5

1 comment:

Powered by Blogger.