Program to find largest of three numbers using pointers

// Program to find largest of three numbers using pointers
#include<stdio.h>
int* large(int *a,int *b,int *c)
{
if(*a > *b)
{
if(*a > *c)
{
return a;
}
else
{
return c;
}
}
else
{
if(*b > *c)
{
return b;
}
else
{
return c;
}
}
}
void main()
{
int x, y, z,*l;
int *a, *b, *c;
printf("\n Enter three numbers:");
scanf("%d%d%d",&x, &y, &z);
l=large(&x,&y,&z);
printf(" %d is largerest of %d, %d and %d \n", *l , x , y , z);
}
Output

Comments

Popular posts from this blog

Install VS-Code in Manjaro Linux

Running (pre-loaded)Virtual Machine on VirtualBox

Integrating Bash on Windows(Linux subsystem) into VSCode