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