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

What is a string ? Write a function in C for string concatenation. Without the use of inbuilt string function?

What is the scope of a Variable? Explain the difference between a global and local variables with example programs.

What is a pointer ? Write a C program using pointer to print the name and price of the items sold in a retail shop on a specific date.