Q:

Write a java program that will read an integer n and then print the line: “You are in CSC111” n times. Create a project Lab05 for all your classes and Name your class Line

0

Write a java program that will read an integer n and then print the line: “You are in CSC111” n times. Create a project Lab05 for all your classes and Name your class Line

 

Sample run:

Enter n : 3

You are in CSC111

You are in CSC111

You are in CSC111

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import java.util.Scanner;
public class Lab5 {
    public static void main(String[] args) {        
       Scanner input=new Scanner(System.in);
        System.out.println("enter integer n : ");
        int n=input.nextInt();
        while(n>0)
        {
            System.out.println("You are in CSC111");
            n--;
        }
}
}

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now