C Program Arithmetic



Write a program that asks the user to enter five numbers obtains them from the user    and prints their sum, product, difference, quotient and remainder







Solution

#include<stdio.h>
#include<stdlib.h>

/*function main begins program execution */
int main(void)
{
    int a,b,c,d,e; /* numbers to be entered by user */

    printf("Input Five Integers:"); /*prompting command for user */
    scanf("%d%d%d%d%d", &a, &b,&c,&d,&e);


    /*Output Results */

    printf("Sum is:%d\n",a+b+c+d+e); /* \n means new line */
    printf("Product is:%d\n", a*b*c*d*e);
    printf("Difference is:%d\n", a-b-c-d-e);
    printf("Division is:%d\n", a/b/c/d/e);
    printf("Remainder is:%d\n", a%b%c%d%e);

    return 0;

}

Comments

Popular posts from this blog

Body Mass Index Calculator In C

Adding two Integers in Java Application

Calculating Product, sum, difference, and quotient of Five Integers