Thursday, June 30, 2016

Example of Algorithm to C program conversion.

/* Example of Algorithm to C program conversion.

Problem Definition: Write an algorithm for Subtracting two Numbers.
Step 1: Start.
Step 2: Read two numbers A and B.
Step 3: Answer = A - B.
Step 4: Display Answer.
Step 5: Stop
*/

#include<stdio.h>
int main()
{
int A, B, Answer;

printf("Enter number A:");
scanf("%d",&A);

printf("Enter number B:");
scanf("%d",&B);

Answer = A - B;
printf("%d", Answer);
 return 0;
}
* * * * *

No comments:

Post a Comment