Tuesday, June 11, 2019

find the large value in given two integer using function in c

#include <stdio.h>

/* function declaration */
int max(int num1, int num2);

int main () {
    int a;
   int b;
   int ret;

   printf("enter the values\n");
   scanf("%d%d",&a,&b);


   ret = max(a, b);
   printf( "Max value is : %d\n", ret );

   return 0;
}

/* function returning the max between two numbers */
int max(int num1, int num2) {

   int result;

   if (num1 > num2)
      result = num1;
   else
      result = num2;

   return result;
}

output::

little compressed the program:

#include <stdio.h>

/* function declaration */
int max(int num1, int num2);

int main () {
    int a,b,ret;
    printf("enter the values\n");
   scanf("%d%d",&a,&b);
   ret = max(a, b);
   printf( "Max value is : %d\n", ret );
   return 0;
}
/* function returning the max between two numbers */
int max(int num1, int num2)
 {
   if (num1 > num2)
      return num1;
   else
      return num2;
}







Note:

please send the questions which you are facing problem in C Language.

also write interview questions which are you faced in during interview related to C Language.

so i can try to solve them and send you back.

No comments:

Post a Comment

python class topic video