menu search
brightness_auto
more_vert
C Program for Addition, Subtraction, Multiplication, Division and Modulus of Two Numbers
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike

1 Answer

more_vert
 
verified
Best answer
#include <stdio.h>
#include <conio.h>
 
int main(){
     
    int firstNumber, secondNumber;
    int sum, difference, product, modulo;
    float quotient;
    printf("Enter First Number: ");
    scanf("%d", &firstNumber);
    printf("Enter Second Number: ");
    scanf("%d", &secondNumber);
     
    //Adding two numbers 
    sum = firstNumber + secondNumber;
    // Subtracting two numbers
    difference = firstNumber - secondNumber;
    // Multiplying two numbers
    product = firstNumber * secondNumber;
    // Dividing two numbers by typecasting one operand to float
    quotient = (float)firstNumber / secondNumber;
    //returns remainder of after an integer division 
    modulo = firstNumber % secondNumber;
     
    printf("\nSum = %d", sum);
    printf("\nDifference  = %d", difference);
    printf("\nMultiplication = %d", product);
    printf("\nDivision = %.3f", quotient);
    printf("\nRemainder = %d", modulo);
     
    getch();
    return 0;
}

 

thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike

Related questions

thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
0 answers
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
1 answer
thumb_up_off_alt 500 like thumb_down_off_alt 0 dislike
1 answer

5.2k questions

4.7k answers

75 comments

393 users

...