DEVELOP AN ALGORITHM, FLOWCHART, AND PROGRAM TO ADD TWO NUMBERS?

 DEVELOP AN ALGORITHM, FLOWCHART, AND PROGRAM TO ADD TWO NUMBERS?

Step 1: Start

Step 2: Declare variables num1, num2, and sum.

Step 3: Read values for num1, num2.

Step 4: Add num1 and num2 and assign the result to a variable sum.

Step 5: Display sum

Step 6: Stop


#include<stdio.h>

int main()

{

int num1,num2,sum;

printf("\n Enter the first number to be added: ");

scanf("%d",&num1);

printf("\n Enter the second number to be added: ");

scanf("%d",&num2);

sum = num1 + num2;

printf("\n The sum of two numbers is: %d",sum);

return 0;

}


What do      you think?               
I hope, now you have a better understanding of adding two numbers. Comments and suggestions regarding this article are welcome.

Comments

Popular posts from this blog

Write a C program to check whether a given string is a palindrome or not.

What is a file in C programming ? Explain the use of fopen function in file handling. Explain different mode in which a file can be opened.

Explain different arithmetical and logical operators available in C, with the help of examples.