In: Computer Science
Please! I want the instructions of how to solve it, not the answer.
Write a program that does the following in order: 1. Asks the user to enter a name 2. Asks the user to enter a number “x” 3. Asks the user to enter a number “y” 4. Calculates the sum of “x” and “y” 5. Prints out the number for “x”, “y” and “sum” An example of the program input and output is shown below: Enter your name: Belinda Patton Enter number x: 50 Enter number y: 10 The sum of 50 and 10 is 60
//first take the variables and intialize thier data types
//then using scanf take the inputs from the user
//then sum the numbers by + oprator
//print the sum using printf
#include<stdio.h>
void main()
{
char a[50];
int x,y,sum;
printf("enter name");
scanf("%s",a);
printf("enter number x");
scanf("%d",&x);
printf("enter number y");
scanf("%d",&y);
sum=x+y;
printf("the sum of %d and %d is %d \n",x,y,sum);
}
please rate my answer....