COMPUTER PROGRAMMING FUNDAMENTALS
WHAT IS PROGRAMMING
Question
[CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
|
Develop an algorithm to input two numbers, add them and output the result.Start read num1, num2 sum <-num1+num2 print sumStopWhat is accomplished by the algorithm above?
|
The algorithm prints the two numbers, calculates the sum and prints the sum
|
|
The algorithms adds the values stored in num1 and num2 and stores the result in the variable sum
|
|
The algorithm will not accomplish anything because their is no value.
|
|
The algorithm stores the result in num1 and num2 and sets it to sum and prints sum
|
Explanation:
Detailed explanation-1: -Algorithm: To find the sum and product of two given numbers: Step 1: Read A, B Step 2: Let Sum= A+B Step 3: Let Product=A*B Step 4: Print Sum, Product Step 5: Stop.
Detailed explanation-2: -printf("Enter two integers: “); scanf("%d %d", &number1, &number2); Then, these two numbers are added using the + operator, and the result is stored in the sum variable. Finally, the printf() function is used to display the sum of numbers. printf("%d + %d = %d", number1, number2, sum);
There is 1 question to complete.