20 thoughts on “Java Programming Tutorial – 22 – for Loops

  1. I dont knoq why i did not manage to understand how 'for' worked in Java but thanks to your explanation i get it now. Even tho i prefer using do-while… when possible haha.

  2. exclusive for intelliJ users there are lot of super useful commands out there like
    sout + tab = System.out.println();
    psvm = public static void main(String []args){}
    fori = for( i = 1 i <=0 i++){}
    i found and discovered many myself but these are the most and frequently being used in my code hope helpful for you and sves you from a typing all the stuff

  3. basic for loop average 🙂


    double grade, total =0,average;
    int i,a;
    Scanner in = new Scanner (System.in);
    System.out.println("Input how many quiz: ");
    a= in.nextInt();

    for(i = 1;i<=a;i++) {
    System.out.println("Input grade for "+i);
    grade = in.nextDouble();
    total = total +grade;
    average = total/a;
    System.out.printf("your average %5.2f" ,average);

  4. import java.util.Scanner;

    class mere {
    public static void main(String[] args) {
    Scanner sc = new Scanner(System.in);
    int increment, end, counter;
    System.out.println("Enter your starting number: ");
    counter = sc.nextInt();
    System.out.println("Enter your ending number ");
    end = sc.nextInt();
    System.out.println("Enter the increment number: ");
    increment = sc.nextInt();
    System.out.println("Your numbers are:");
    for(counter=counter; counter<= end; counter= counter + increment)
    System.out.print(counter+"; ");

Leave a Reply to Div Gupta Cancel reply

Your email address will not be published. Required fields are marked *