Saturday, July 28, 2018

Addition two integer number

In this program user is asked to enter two integers.When users entered two number in variables firstNumber and secondNumber rightly. Then will be done using  scanf() function.
And then this two variables are added using + operator and the result is d in sumOfTwoNumbers.

So, lets see the program and also see the output in below of the program.


#include <stdio.h>
int main()
{
    int firstNumber, secondNumber, sumOfTwoNumbers;

    printf("Enter two integers: ");


    scanf("%d %d", &firstNumber, &secondNumber);


    sumOfTwoNumbers = firstNumber + secondNumber;


    printf("%d + %d = %d", firstNumber, secondNumber, sumOfTwoNumbers);

    return 0;
}

Output:


No comments:

Post a Comment

C program for find square value

This is an example of how to find square value of a number using function.  #include<stdio.h> float square ( float x ); int ma...