#include <stdio.h>
#include <conio.h>
int main()
{
int a, b, c;
printf("Enter two numbers to add ");
scanf("%d%d",&a,&b);
c = a + b;
printf("Sum of entered numbers = %d\n",c);
getch();
return 0;
}
OUTPUT:
Enter two numbers to add 5
6
Sum of entered numbers = 11
Sample C Program To Perform Arithmetic Operations.
#include <stdio.h>
#include <conio.h>
int main()
{
int first, second, add, sub, mul, div;
printf("Enter Two Numbers ");
scanf(" %d %d ", &first, &second);
add = first + second;
sub = first - second;
mul = first * second;
div = first / second;
printf("Sum Of Numbers = %d\n",add);
printf("Difference Of Numbers = %d\n",sub);
printf("Multiplication Of Numbers = %d\n",mul);
printf("Division Of Numbers = %d",div);
getch();
return 0;
}
OUTPUT:
Enter Two Numbers 4
2
Sum Of Numbers = 6
Difference Of Numbers = 2
Multiplication Of Numbers = 8
Division Of Numbers = 2
ALSO READ:
-- Program To Print First Ten(10) Natural Numbers.
-- Program To Print Fibonacci Series Upto 100.
-- Program To Check Whether A Number Is Prime Or Not.
-- Program To Compute The Reverse Of A Number.
-- Program To Print A Semicolon Without Using A Semicolon.
-- Program To Display Function Without Using The Main Function.
-- Program To Print Any Print Statement Without Using Semicolon.
-- Program To Display Its Own Source Code As Its Output.
-- Program To Swap Two Strings Using strcpy() Function.
-- Program to accept a string and print the reverse of the given string.
-- Program To Get IP Address.
-- Program To Accept An Integer & Reverse It.
-- Program To Convert Given Number Of Days To A Measure Of Time Given In Years, Weeks & Days.
-- Program To Illustrate The Concept Of Unions.
-- Program To Find The Size Of A Union.
... Back To C++ Programs Index
... Back To C++ FAQ's Index
... Back To C Programs Index
... Back To C FAQ's Index
... Back To HR Interview Index
Comments
Post a Comment
Please share your opinions and suggestions or your experience in the comments section. This way we can all help each other...
Experienced guys can share their resumes at admin@interview-made-easy.com