Menu
Question Index
...

Write a program using for loop to print the numbers till the given input. Spaces between numbers are important and they should be in one line. Use System.out.println or System.out.print for printing.

Integer (Input) Printed Output
4 1 2 3 4
7 1 2 3 4 5 6 7
10 1 2 3 4 5 6 7 8 9 10



class PrintNumbersUsingFor
{
    public static void main(String s[])
    {
        printNumbers(5);

    }


    public static void printNumbers(int input)
    {
    }

}

Doubts

Problems

Topic: for Loop In Java

Read this topic
Take test on this topic

0
Wrong
Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App