Question

Define an int variable. Read an int value from the keyboard into the variable. Print the...

Define an int variable.

Read an int value from the keyboard into the variable.

Print the variables value.

Homework Answers

Answer #1

//C program

#include<stdio.h>

int main(){
   //Defining an int variable(number).
   int number;
  
   printf("Enter number : ");
   //Reading an int value from the keyboard into the variable number.
   scanf("%d",&number);
  
   //Printing the variable number value
   printf("You entered : %d\n",number);
   return 0;
}

//sample output

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
1) What do you think the following program will print if you type from the keyboard...
1) What do you think the following program will print if you type from the keyboard the numbers 3 for a and 8 for b ? #include < iostream> using namespace std; int main() { int a, b; cin >> a >> b; if (a > b && b > 7) { if(a < 7) cout << “ a less than 7: “ << a << ‘\n’; else cout << “Else branch executed\n”; return 0; }
Given an int variable n that has already been declared and initialized to a positive value...
Given an int variable n that has already been declared and initialized to a positive value and another int variable j that has already been declared , use for loop to print a single line consisting of n asterisk. Thus if n contains 5 , five asterisks will be printed. Use no variables other than n and j. ( please use C standard)
Create a c file to read a character from the keyboard and write it to a...
Create a c file to read a character from the keyboard and write it to a file. please help
Two int numbers are entered through the keyboard. Write a c++ program to find the value...
Two int numbers are entered through the keyboard. Write a c++ program to find the value of one number raised to the power of another. (Do not use the pow() function. Ex: Enter two int numbers: 5 3 5 * 5 * 5 = 125 Ex: Enter two int numbers: 5 -3 1/(5 * 5 * 5) = 1/125 = 0.008 Ex: Enter two int numbers: -2 -3 1/(-2 * -2 * -2 )= 1/-8 = -1/8 = - 0.125
Write a program which inputs an integer value, incr, from the user at the keyboard, and...
Write a program which inputs an integer value, incr, from the user at the keyboard, and then displays a graph of the sine of the degree values from 0 to 180, in increments of incr. You must use the sin function (in a similar manner to ceil and floor) to find the sine. Note that the sin function only operates on radians so the degree value must first be converted to radians. To do so, multiply the degree value by...
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a...
IN MIPS ASSEMBLY Macro File: Create macros to print an int, print a char, print a string, get a string from the user, open file, close file, read file, and allocate heap memory. You can use more macros than these if you like. Main Program File: Allocate 1024 bytes of dynamic memory and save the pointer to the area. The main program is a loop in which you ask the user for a filename. If they enter nothing for the...
Complete the Python programming snippet given below based on the information provided here. a = int(input("Enter...
Complete the Python programming snippet given below based on the information provided here. a = int(input("Enter variable a:")) b = int(input("Enter variable b:")) print(a,b) a = a + b # enter your solution here # end of your code print(a,b) Two values are entered and stored into the variables a and b. The values of the variables are then switched so that the variable b now contains the original value of the variable a and the variable a now contains...
1) Create an interface to the keyboard (Scanner). Scanner is described in Chapter 2. 2) Prompt...
1) Create an interface to the keyboard (Scanner). Scanner is described in Chapter 2. 2) Prompt the user to enter their first and last name.. 3) Read the name into a String. 4) Print a person greeting such as “Hello FirstName LastName”. Print the users name in the greeting. 5) Prompt the user to enter 2 integers. 6) Read the integers into 2 variables into your program. 7) Prompt the user to enter a math operation – one of +,-,*,/...
How would I write this function in C programming language? Function header: int input(int *a, int...
How would I write this function in C programming language? Function header: int input(int *a, int *b, int *c) This function should attempt to input 3 integers from the keyboard and store them in the memory locations pointed to by a, b, and c. The input may not be successful in reading all three values. The function should return the number of values that were successfully read.
Write a MARIE assembly program to read three different positive numbers from the keyboard and output...
Write a MARIE assembly program to read three different positive numbers from the keyboard and output the difference between the largest and smallest numbers to the screen.