Saturday, December 14, 2019

Write a source code for C++ and Java program to find biggest of three numbers?





 Source code for C++  program to find biggest of three numbers


#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int a,b,c;
cout<<"  Enter three digit number"  ;
cin>>a>>b>>c;
//Biggest of three numbers
if ( a > b && a>c)
{
cout<<""  a is big"   ;
}
else if ( b > c)
{
cout<<""   b is big"   ;
}
else
{
cout<<""  c is big"   ;
}
getch( );
}

Source code for  Java program to find biggest of three numbers

//Biggest of three numbers
import java.util.Scanner;
class BiggestNo
{
public static void main(String []args)
{
int a,b,c;
Scanner sc=new Scanner(System.in);
System.out.println ("  Enter three digit number: "   );
a=sc.nextInt( );
b=sc.nextInt( );
c=sc.nextInt( );
if ( a > b && a>c)
System.out.println ("  a is big"   );
else if ( b > c)
System.out.println ("   b is big"   );
else
System.out.println ("   c is big"   );
}
}

No comments:

Post a Comment