Hi,
Below is my program, what it does is asks the user to input both an integer and floating point value. I managed to be able to define the output of the floating point number with the %.2f, but i cannot find a way to output the integer with a maximum of 2 spaces, ie.any number between 0 and 99. Any help at all would be great. Thank you in advance.
Ryan
Added code tagsCode:#include<stdio.h> int main(void) { int integer; float floatingPoint; printf("Please input an integer value: "); scanf("%i", &integer); printf("Please input a floating point value: "); scanf("%f", &floatingPoint); printf("The integer value you entered was: %2g%i \n", integer); printf("The floating point value you entered was: %.2f \n", floatingPoint); }
Read this -> << !! Posting Code? Read this First !! >>