Write a programme that counts from one to ten, print the value on a separate line for each and include a meaasge of youy choice when the count is 3 and a different message when the count is 7?

Answer :

import java.util.*;
class Choice
{
void main()
{
Scanner sn=new Scanner(System.in);
for(int i =1; i<=10; i++)
{
S.o.pln(i);
if(i==3)
{
S.o.p("enter a message - ");
String s=sn.nextLine();
}
if(i==7)
{
S.o.p("enter a message - ");
s=sn.nextLine();
}
}
}
}

Other Questions