Advertisements
Advertisements
Question
Write a program to display all the numbers between 100 and 200 which don't contain zeros at any position.
For example, 111, 112, 113, ..............................., 199
Answer in Brief
Solution
import java.util.*;
public class Q5
{ public static void main(String args[])
{
Scanner in = new Scanner(System.in);
String name;
double math, eng, sci, avg;
int n;
System.out.printIn("Enter the number of students");
n = in.nextInt();
for (int i = 1; i <= n; i++)
{System.out.print("Enter the name of the student :");
name = in.next();
System.out.print("Enter the marks scored in math: ");
math = in.nextDouble();
System.out.print("Enter the marks scored in English: ");
eng = in.nextDouble();
System.out.print("Enter the marks scored in science: ");
sci = in.nextDouble();
avg = (math + sci + eng) / 3;
System.out.println("Name: " + name);
System.out.println("Average: " + avg);
System.out.println();
}}}
shaalaa.com
Is there an error in this question or solution?