Pages

Get Maximum number from given numbers using function

Friday, 19 April 2013

#include <stdio.h>

#include <conio.h>
// Define of function
int max_return(int a, int b, int c, int d, int e)
{
int max;

max = a;

if(max < b) max = b;
if(max < c) max = c;
if(max < d) max = d;
if(max < e) max = e;

return (max);

}

int main(void)
{
int a[5];
int max, i;


for(i=1; i<=5; i++)
{
         printf("Enter number %d :", i);
         scanf("%d", &a[i]);
}
// Recall function
max = max_return(a[0], a[1], a[2], a[3], a[4]);
printf("Maximum = %d\n", max);


getch();
}

 

Search Box

Most Reading

Contact Form

Name

Email *

Message *