Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Multiples of 3 problem

$
0
0
Hey everyone :

I have written the following piece of code :
import java.util.Scanner;
public class question1 {
public static void main(String[] args) {



Scanner keyboard = new Scanner(System.in);

int number = 0 ;
System.out.print("Please enter your number");
number = keyboard.nextInt();

while (number > 0)
{	
System.out.print("*");
number --;
}



}	

}


now Im asked to edit so it will ask the user to enter a single integer value n and then it should print out the first n of 3 , eg if 4 is entered the output should be : 0 3 6 9.

Im totaly lost , thanks for help ! :)

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>