Computer Science, asked by vishal5040, 1 year ago

WRITING A C PROGRAM

Answers

Answered by swatianurish
0

Answer:

C program to get input from a user using scanf

#include <stdio.h>

 

int main()

{

 int x;

 

 printf("Input an integer\n");

 scanf("%d", &x); // %d is used for an integer

 

 printf("The integer is: %d\n", x);

 

 return 0;

}

Output:

Input an integer

7897

The integer is: 7897

Answered by tiger009
0

C Program of Addition.

Output:

Enter two numbers: 25 15

Addition: 40

Explanation:

The following are the program in the C Programming Language.

#include <stdio.h>

int main(void)  

{

 int x, y;

 printf("Enter two numbers: ");

 scanf("%d %d",&x,&y);

 printf("Addition: %d", x+y);

 return 0;

}

The following are the description of the program.

  • Firstly, define the required header file and declare the main method, inside the function.
  • Declare the two integer data type variables that are 'x' and 'y' then, print the following message and get input in the following variables from the user.
  • Finally, print the addition of the input from the user with the message.

Learn More:

https://brainly.in/question/15440271

Similar questions