Printf Practice

These exercises allow you to practice displaying values on the screen using printf().

setup

method 1: Easy Formatting

1024
4.417
Dante's Inferno

method 2: Formatting Values with Text

I was born in July and this year I will be 17 years old.

method 3: Complex Formatting

|1024|
|  1024|
|    1024|
|00001024|
|001024|

|4.417000|
|4.4|
|      4.42|

|Dante's Inferno|
|          Dante's Inferno|
|Dante's Inferno          |

method 4: Table of Students

+-------------------------------------------+
| Bell        Faye      833055   9  103.03  |
| Chatterton  Michelle  820335  11   92.00  |
| Holder      Anthony   848040  10   82.11  |
| Rush        Ed        822535  12  101.08  |
| Longhurst   Kevan     832985   9   96.40  |
+-------------------------------------------+
String last1 = "Bell";
String last2 = "Chatterton";
String last3 = "Holder";
String last4 = "Rush";
String last5 = "Longhurst";

String first1 = "Faye";
String first2 = "Michelle";
String first3 = "Anthony";
String first4 = "Ed";
String first5 = "Kevan";

int stuid1 = 833055;
int stuid2 = 820335;
int stuid3 = 848040;
int stuid4 = 822535;
int stuid5 = 832985;

int gr1 = 9;
int gr2 = 11;
int gr3 = 10;
int gr4 = 12;
int gr5 = 9;

double gpa1 = 103.03;
double gpa2 = 92;
double gpa3 = 82.11;
double gpa4 = 101.08;
double gpa5 = 96.4;