Skip to content

Instantly share code, notes, and snippets.

@LokeshKumarES
Created September 13, 2018 14:43
Show Gist options
  • Save LokeshKumarES/87f02d1fcdf63408752f6914486edd77 to your computer and use it in GitHub Desktop.
Save LokeshKumarES/87f02d1fcdf63408752f6914486edd77 to your computer and use it in GitHub Desktop.
2-Write a C program to perform basic functionality of calculator
#include<stdio.h>
#include<conio.h>
void main()
{
int a, b, add, sub, mul;
float div;
printf("Enter First Number: ");
scanf("%d",&a);
printf("Enter Second Number: ");
scanf("%d",&b);
add=a+b;
sub=a-b;
mul=a*b;
div=a/b;
printf("The addition of %d and %d is: %d\n", a, b, add);
printf("The subtraction of %d and %d is: %d\n", a, b, sub);
printf("The multiplication of %d and %d is: %d\n", a, b, mul);
printf("The division of %d and %d is: %f\n", a, b, div);
getch();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment