Computer Science, asked by kinghacker, 1 day ago

Question:-
Write counting up to ∞​

Answers

Answered by kushagrav265
4

import java.io.*;

import java.util.*;

class Count{

int n,i;

public static void main(String args[ ]){

Scanner sc = new Scanner(System.in){

System.out.println("Enter any number:");

n = sc.nextInt();

for(i=1;i≤n;i++);

System.out.println(i +"\t");

}

}

Output:

Please enter any number:10

1 2 3 4 5 6 7 8 9 10

Explaination:

First, we used the Java For loop to iterate from 1 to maximum value (Here, number = 10).

User entered value: number = 10

For Loop First Iteration: for(i = 1; i <= 10; i++)

Condition is True. So, i Value printed (i.e., 1)

Note:-

Dont give space between the square brackets in args.

Hope this helps :)

Plz mark me as brainliest

Answered by MichTeddy
13

Answer:

ur answer izz in attachment

Explanation:

I hope it's helpful to u

:)

Attachments:
Similar questions