These are the directions:
1. Prompt the user to enter a character, an integer value (between 0 and 9), and a float value.
2. Use printf formatting to print each value on its own line with the following specifications:
a. All values should be right aligned 10 spaces from the left of the screen
b. The integer should have 2 preceding zeros
c. The float value should be printed with 3 decimal places
This is what I have so far:
I am having a problem figuring out how to print out the character and printing it out 10 spaces to the left of the screen.Code:#include<stdio.h> int main(void) { char ch; int integer; float value; printf("Please enter a character: "); scanf(" %c", &ch); printf("Please enter an integer value: "); scanf("%d", &integer ); printf("Please enter a float value: "); scanf("%f", &value ); printf("You Entered \n%c\n%2d\n%7.2f"); return 0; }



LinkBack URL
About LinkBacks


