a program on : input a no. and print if it is a buzz no.
Shridhar023:
in which class you are?
Answers
Answered by
3
NOTE : THE STATEMENT IN BOLD HAS TO BE WRITTEN IN ONE LINE ONLY.
import java.io.*;
class Buzz
{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a;
public void show()throws Exception
{ System.out.println("Enter the number:"); a=Integer.parseInt(br.readLine());
if(a%10==7 || a%7==0)
System.out.println("Entered number is a Buzz number.");
else
System.out.println("Entered number is not a Buzz number.");
}
public static void main(String args[])throws Exception
{
Buzz ob=new Buzz(); ob.show();
}
}
import java.io.*;
class Buzz
{ BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int a;
public void show()throws Exception
{ System.out.println("Enter the number:"); a=Integer.parseInt(br.readLine());
if(a%10==7 || a%7==0)
System.out.println("Entered number is a Buzz number.");
else
System.out.println("Entered number is not a Buzz number.");
}
public static void main(String args[])throws Exception
{
Buzz ob=new Buzz(); ob.show();
}
}
Answered by
0
Pseudo code:
while (number > 99) number /= 10;
if (number % 10) == 7 print("It's a buzz number);
while (number > 99) number /= 10;
if (number % 10) == 7 print("It's a buzz number);
Similar questions