i have it done, what i made was a table, it keeps out putting every conversion from 1 gallon to 100 gallons, i was woundering what if you made it go longer and if int won't hold it then i would just use long instead of int becuase int hold 32 bits(-2,147,483,648 upto 2,147,483,648,whereas long can hold up to 64 bits,and i'm too lazy to type out the range of that), anyways i was just woundering after i created the table.(i know this process isn't that great, its not efficient and its alot to scroll through but that is how i am learning it right now since i'm new)
*putting in the code, may help if not understandable still*
CODE
/*
This program displays a conversion
table for gallons to liters
uses the for loop
*/
class GaltoLitTable {
public static void main(String args[]) {
double gallons, liters;
int counter;
counter = 0; //start counter at 0
for(gallons = 1; gallons <= 100; gallons++) {
liters = gallons * 3.7845; // conversion
System.out.println(gallons+" gallons = "+liters+" liters.");
counter++; //increment line counter (by 1) with each loop iteration
//every 10th line print a blank for easy readablity
if(counter == 10) {
System.out.println();
counter = 0; //reset the counter
}
}
}
}