WRITE THE PROGRAM IN SCANNER CLASS:
1) WRITE A PROGRAM TO DISPLAY THE NAMES OF FIVE FRUITS WITH A SINGLE System.out.println (); STATEMENT, BUT IN DIFFERENT LINES.
2) WRITE A PROGRAM USING VARIABLES TO FIND THE PROFIT PERCENT OF A CERTAIN TRANSACTION WHERE S.P=RS10000 AND C.P=RS 7000.
Answers
Answered by
1
First program
class demo
{
public static void main()
{
System.out.println("Mango"/n"Grapes"/n"Apple"/n"Banana"/n"orange");
}
}
Second program
class demo
{
public static void main()
{
double sp=10000,cp=7000,p,profperc;
p=sp-cp;
profperc=(p/cp)*100
System.out.println(profperc);
}
}
Similar questions