Simple Calculator in C

Simple Calculator In C 




Source Code :

#include<stdio.h>

int main()
{
int a,b,ch;
printf("1 for Addision\n2 for Substraction\n3 for Multiplication\n4 for Division\n");
printf("Enter First Value : ");
scanf("%d",&a);
printf("Enter Operator : ");
scanf("%d",&ch);
printf("Enter Second Value : ");
scanf("%d",&b);
switch (ch)
{
case 1:
printf("Added Value : %d",a+b);
break;
case 2:
printf("Substracted Value : %d",a-b);
break;
case 3:
printf("Multiplied Value : %d",a*b);
break;
case 4:
printf("Divided Value : %d",a/b);
break;
default:
printf("Invalid Selection or Number");
}
return 0;
}




Paste this code into your code editor.

Subscribe to United Vibes





Comments

Popular posts from this blog

Basic Number Guessing Game In C++ using VISUAL STUDIO.