#include <stdio.h>
int main()
{ int a,b,c;
printf("Enter the numbers ");
scanf("%d %d",&a,&b); //Input the numbers
c=a+b; //performing the operater
printf("The sum is %d",c); // printing the value
return 0;
}
#include <stdio.h>
int main()
{ int a,b,c;
printf("Enter the numbers ");
scanf("%d %d",&a,&b); //Input the numbers
c=a-b; //performing the operater
printf("The difference is %d",c); // printing the value
return 0;
}
#include <stdio.h>
int main()
{ int a,b,c;
printf("Enter the numbers ");
scanf("%d %d",&a,&b); //Input the numbers
c=a*b; //performing the operater
printf("The multiplication is %d",c); // printing the value
return 0;
}
#include <stdio.h>
int main()
{ int a,b,c;
printf("Enter the numbers ");
scanf("%d %d",&a,&b); //Input the numbers
c=a/b; //performing the operater
printf("The division is %d",c); // printing the value
return 0;
}
Alternative approach -
(using only 2 variables)
#include <stdio.h>
int main()
{ int a,b;
printf("Enter the numbers ");
scanf("%d %d",&a,&b); //Input the numbers
printf("The sum is %d",a+b); // printing the value
return 0;
}
0 Comments