Skip to main content

Posts

Showing posts with the label 2. Write a C program to enter two numbers and perform all arithmetic operations.

ads1

2. Write a C program to enter two numbers and perform all arithmetic operations.

    2. Write a C program to enter two numbers and perform all arithmetic operations. Solution :-  #include<stdio.h> #include<conio.h> void main() {     clrscr();     int a,b,add,sub,mul,div,mod;     printf("Enter the First number :-");     scanf("%d",&a);     printf("Enter the Second number:-");     scanf("%d",&b);     add = a+b;     sub = a-b;     mul = a*b;     div = a/b;     mod = a%b;     printf("The Sum of 2 number is :- %d\n",add);     printf("The Sub of 2 number is :- %d\n",sub);     printf("The Mul of 2 number is :- %d\n",mul);     printf("The Div of 2 number is :- %d\n",div);     printf("The Mod of 2 number is :- %d\n",mod); getch(); } Output :-     

ads2