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
Post a Comment