Menu
Question Index
...

Write a program to print the numbers till the input using while loop. The spaces between the 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
6 1 2 3 4 5 6
10 1 2 3 4 5 6 7 8 9 10



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

    }


    public static void printNumbers(int input)
    {
    }

}

Doubts

Problems

Topic: while 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