Program to Define a class having three numbers as data members. Initialize and display the greatest of the three numbers.
class Prog3
{
public static void main(String args[])
{
int a=20,b=8,c=10;
if(a>b && a>c)
{
System.out.println("The greatest no. is a:"+a);
}
else if(b>a && b>c)
{
System.out.println("The greatest no. is b:"+b);
}
else if(c>a && c>b)
{
System.out.println("The greatest no. is c:"+c);
}
else
{
System.out.println("all are equal");
}
}
}
Pankaj Gaikar is a
professional blogger
from Pune, India who writes on Technology, Android,
Gadgets, social media and latest tech updates at
Punk Tech
,
Being Android
&
Shake The Tech
. Email me
HERE
0 comments :
Post a Comment