Sunday, February 9, 2020

Kerala State Rutronix , Pratical Examination -feb 2015 java and C++ Answer









Java Program

import java.util.Scanner;
class calc
{
void maxi( int a,int b)
    {
    if (a>b)
        System.out.println("  Maximum   :" +a);
    else
        System.out.println("  Maximum  :  " +b);
    }
void maxi( int a,int b,int c)
    {
    if (a>b & a>c)   
        System.out.println("  Maximum  :" +a);
            else
        if(b>a & b>c)
                System.out.println("  Maximum  :" +b);
            else
                System.out.println("  Maximum  :" +c);
    }
}
class max
{
public static void main(String[]args)
{
int d,e,f;
calc m=new calc( );
System.out.println(" Enter any three value"  );
Scanner k=new Scanner(System.in);
d=k.nextInt( );
e=k.nextInt( );
f=k.nextInt( );
m.maxi(d,e);
m.maxi(d,e,f);
}
}


 C++ Program

#include<iostream.h>
#include<conio.h>
int max(int a,int b)
{
if (a>b)
cout<<"  Maximum  :"  <<a<<endl;
else
cout<<"  Maximum  :"   <<b<<endl;
}
int max(int a,int b,int c)
{
if (a>b && a>c)
cout<<"   Maximum   :"   <<a<<endl;
else
if (b>a && b>c)
cout<<"  Maximum   :"  <<b<<endl;
else
cout<<"   Maximum   :"   <<c<<endl;
}
void main()
{
clrscr();
int d,e,f;
cout<<"  Enter three integer value:"   <<endl;
cin>>d>>e>>f;
max(d,e);
max(d,e,f);
getch();
}

No comments:

Post a Comment