Sum Of Two Number In C Programming
Maths and logic are the necessary parts of programming that can be learned through practice. Here is a simple mathematical problem of addition for you.
- Write a program to print the sum of two integers.
Instructions:
- Define two integer variables
- Get the input for the two variables.
- Write The logic to add the two variables.
- Print the sum.
Instructions:
- Define two integer variables
- Get the input for the two variables.
- Write The logic to add the two variables.
- Print the sum.
Input:
#include <stdio.h>
int main(){
int num1, num2; // Define two integer variables
scanf("%d %d", &num1, &num2); // Get input for the two variables
int sum = 0;
// Write the logic to add these numbers here:
sum=(num1+num2);
printf("%d\n", sum); // Print the sum
return 0;
}
Let See Computer Screen:
int main(){
int num1, num2; // Define two integer variables
scanf("%d %d", &num1, &num2); // Get input for the two variables
int sum = 0;
// Write the logic to add these numbers here:
sum=(num1+num2);
printf("%d\n", sum); // Print the sum
return 0;
}
Let See Computer Screen:
0 comments :
computer books list list of computer science books with authors best computer books for beginners fundamental of computer books pdf free download computer books for dummies best computer hardware books introduction to computer best computer books of all time
Powered by Blogger.
Menu Footer Widget
Followers
Search This Blog
Translate
Contact
Popular Posts
-
Software development life cycle sometime reffer to as system development life cycle and abbreviated as SDLC. A life cycle and abbreviated a...
-
Software is collection of data or computer instructions that tell the computer how to work. Examples of application software include off...
-
Suppose the program print "Hello" and Print "What is your name " then takes input from user and again print a line with...
Post a Comment