Write a C program that will: Create two int variables: myint /* stores an intege
ID: 3628613 • Letter: W
Question
Write a C program that will:
Create two int variables:
myint /* stores an integer */
mychar /* stores a single character value */
Prompt the user for an integer value (use a printf statement)
Input an int value and store it in myint (use a scanf statement)
Prompt the user for a single character (A – Z)
Input a char value and store it in mychar
Output the value of myint in a line of text that tells the user this is the integer you input
Output the value of mychar in a line of text that tells the user this is the character you input
Always end your last output (printf) with a NL character ‘ ’ to force any following text to the next line on the screen.
Use a return statement to end your program.
Explanation / Answer
#include<stdio.h>
#include<conio.h> // remove thisifu are in linux.
void main()
{
int myint;
char mychar;
printf(" Enter an Integer Value :");
scanf("%d",&myint);
printf(" Enter a Character (A-Z):");
mychar=getche();
getche();
printf(" The integer you input is :%d",myint);
printf(" The character you input is :%c",mychar);
getch();
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.