Program for calculate Addition,multiplication,subctration,modulas,division by c programming

code

#include <stdio.h>
void main()

{
    int a,b;
    int sum,sub,mult,mod;
    float div;

    printf("Enter number a\n");
    scanf("%d",&a);
    printf("Enter number b\n");
    scanf("%d",&b);

    sum = a+b;
    sub = a-b;
    mult =a*b;
    mod = a%b;
    div = a/b;

    printf("The sum of the given numbers : %d\n",sum);
    printf("The difference of the given numbers : %d\n",sub);
    printf("The product of the given numbers : %d\n",mult);
    printf("The quotient of the given numbers : %f\n",div);
    printf("Modulus= %d\n",mod);
    
}

output

Enter number a
54
Enter number b
76
The sum of the given numbers : 130
The difference of the given numbers : -22   
The product of the given numbers : 4104     
The quotient of the given numbers : 0.000000
Modulus= 54

Leave a comment

Design a site like this with WordPress.com
Get started