Write a program in Java to accept a name and print it thrice.
Answers
Answered by
2
//Print name thrice
import java.util.*;
class Name
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
String s;
System.out.print("Enter your name\n");
s = sc.nextLine();
for(I=1;I<=3;I++)
System.out.println(s);
}
}
Hope this helps you.
Answered by
1
Answer:
//Print name thrice
import java.util.*;
class Name
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
String s;
System.out.print("Enter your name\n");
s = sc.nextLine();
for(I=1;I<=3;I++)
System.out.println(s);
}
}
Read more on Brainly.in - https://brainly.in/question/12709162#readmore
Explanation:
Similar questions
Sociology,
6 months ago
Accountancy,
6 months ago
Chinese,
6 months ago
Physics,
1 year ago
Math,
1 year ago
Biology,
1 year ago
Accountancy,
1 year ago