Computer Science, asked by coolrocksmk, 1 year ago

Write a method Met that accepts as parameter 2 integers a and b. You have to print that number which has a greater value.

Answers

Answered by MKamrulH
0

int Met(int a, int b){

if( a>b)

return a;

else

return b;

} //end of method.

int main()

{

   int x,y,ans;

   printf("Input first value: ");

   scanf("%d",&x);

   printf("Input second value: ");

   scanf("%d",&y);

   ans=Met(x,y);

   printf("\tThe largest value is=%d",ans);

   return 0;

}


Answered by goutamipurra
0

Answer:

public static void Met(int a,int b){

   if(a>b){

       System.out.println(a);

   }

   else

   {

     System.out.println(b);  

   }

}

Explanation:

Similar questions