Write a C Program to Enter two Numbers and Find Their Sum
Objective:
Write a C program to input two numbers from user and calculate their sum. C program to add two numbers and display their sum as output. How to add two numbers in C programming.
Solution Code:
//find sum of two numbers c program by CodexRitik
#include <stdio.h>
int main()
{
int num1, num2, sum;
//Input two numbers from user
printf("Enter first number: ");
scanf("%d", &num1);
printf("Enter second number:");
scanf("%d", &num2);
/* Adding both number */
sum = num1 + num2;
/* Prints the sum of two numbers */
printf("Sum of %d and %d = %d", num1, num2, sum);
return 0;
} |
Note:
This Code is Verified by CodexRitik.If any error occurs then Comment correct code Below in comment box.
Disclaimer:-
The above hole problem solution is generated by the CodexRitik . if any of the query regarding this post or website fill the following contact form Thank You.
Write a C Program to Enter two Numbers and Find Their Sum - Basic C Program
Reviewed by CodexRitik
on
January 03, 2021
Rating:
No comments: