Aman Choudhary BCA-1 C Practical
Aman Choudhary BCA-1 C Practical
PRACTICAL ASSIGNMENT
ON
“PROGRAMMING IN C LANGUAGE ”
Submitted in partial fullfillment of the requierments for the
BACHELOR OF COMPUTER APPLICATION – 1ST YEAR
From
SUBMITTED TO:
GD RUNGTA COLLEGE OF SCIENCE AND TECHNOLOGY, BHILAI (C.G)
CERTIFICATE BY THE EXAMINER
Internal Examiner
Date:
ACKNOWLEDGEMENT
The real spirit of achieving a goal is through the way of excellence and
austerious discipline. I want to thank GDRCST, Bhilai for providing me the
necessary software, tools and other resources to deliver my Practical assignment.
I owe my sincere thanks to Dr. Neema S. Balan, Principal, GDRCST, Bhilai for
inspiration and constant encouragement that enabled me to present my work in
this form.
Prakritee John
Enrollment no.
INDEX
scanf("%d",&i3);
printf("\n\t\t unsigned short int ->>");
scanf("%u",&i4);
//--------------------------Long Integer Input-------------------------------
printf("\n\t Enter any integer value for various long integer datatypes");
printf("\n\t\t long int ->>");
scanf("%ld",&i5);
printf("\n\t\t unsigned long int ->>");
scanf("%lu",&i6);
//-------------------------Float Input----------------------------------------
printf("\n\t Enter any float value for various float datatypes");
printf("\n\t\t float ->>");
scanf("%f",&f);
//------------------------Double Input----------------------------------------
printf("\n\t Enter any float value for various double datatypes");
printf("\n\t\t double ->>");
scanf("%lf",&d1);
printf("\n\t\t long double ->>");
scanf("%Lf",&d2);
//****************************Output******************************
clrscr();
printf("\n\t %c",c1);
printf("\n\t %c",c2);
printf("\n\t %10d",i1);
printf("\n\t %10u",i2);
printf("\n\t %10d",i3);
printf("\n\t %10d",i4);
printf("\n\t %10ld",i5);
printf("\n\t %10lu",i6);
printf("\n\t %10.2f",f);
printf("\n\t %10.2lf",d1);
printf("\n\t %10.2Lf",d2);
getch();
}
Output
c) d)
1 1
1 2 1 2 1
1 2 3 1 3 3 1
1 2 3 4 1 4 6 4 1
Write main function using switch…..else, if..Else and loops which when
called as<s pattern type: If user 11 then first pattern is generated
using for loop, if user enters the 12 then first pattern is generated
using while loop .if user enter 13 then first pattern is generated using
do while loop. If user enters the 21 then a second pattern is generated
using for loop and so on.
Program:
#include<Stdio.h>
#include<conio.h>
#include<math.h>
void main()
{int choice,sel,a,g,i,j,k,l,m,n;
clrscr();
printf("\n\t Press 1 for ");
printf("\n\n\tA B C D C B A");
printf("\n\tA B C C B A");
printf("\n\tA B B A");
printf("\n\tA A");
printf("\n");
printf("\n\t Press 2 for ");
printf("\n\n\t * ");
printf("\n\t * * ");
printf("\n\t * * * ");
printf("\n");
printf("\n\t Press 3 for ");
printf("\n\n\t1");
printf("\n\t1 2");
printf("\n\t1 2 3");
printf("\n");
printf("\n");
}
getch();
}
else
if(sel==12)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 1 by While loop is : ");
printf("\n\n");
i=1;
while(i<=n)
{
a='A';
m=1;
while(m<=(n+1)-i)
{
printf("%c",a);
a++;
m++;
}
k=1;
while(k<=(2*(i-1))-1)
{
printf(" ");
a++;
k++;
}
if(i==1)
{
int l=1;
while(l<=n-i)
{
printf("%c",a);
a++;
l++;
}
}
else
{
int l=1;
while(l<=(n+1)-i)
{
printf("%c",a);
a++;
l++;
}
}
printf("\n");
i++;
}
getch();
}
else
if(sel==13)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 1 by Do While loop is : ");
printf("\n\n");
i=1;
do
{
a='A';
m=1;
do
{
printf("%c",a);
a++;
m++;
}while(m<=(n+1)-i);
if(i>1)
{
k=1;
do
{
printf(" ");
a++;
k++;
}while(k<=(2*(i-1))-1);
}
if(i==1)
{
int l=1;
do
{
printf("%c",a);
a++;
l++;
}while(l<=n-i);
}
else
{
int l=1;
do
{
printf("%c",a);
a++;
l++;
}while(l<=(n+1)-i);
}
printf("\n");
i++;
}while(i<=n);
getch();
}
else
printf("\n\t Invalid Input!!");
break;
case 2:
clrscr();
printf("\n\t Enter 21 to print this pattern using for loop...");
printf("\n\t Enter 22 to print this pattern using While loop...");
printf("\n\t Enter 23 to print this pattern using Do While loop...");
printf("\n\n\t Enter Your Choice : ");
scanf("%d",&sel);
if(sel==21)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 2 by for loop is : ");
printf("\n\n");
for(i=1;i<=n;i++)
{
for(g=1;g<=n-i;g++)
{
printf(" ");
}
for(j=1;j<=(2*i)-1;j++)
{
if(j%2==0)
{
printf(" ");
}
else
{
printf("*");
}
}
printf("\n");
}
getch();
}
else
if(sel==22)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 2 by While loop is : ");
printf("\n\n");
i=1;
while(i<=n)
{
g=1;
while(g<=n-i)
{
printf(" ");
g++;
}
j=1;
while(j<=(2*i)-1)
{
if(j%2==0)
{
printf(" ");
}
else
{
printf("*");
}
j++;
}
printf("\n");
i++;
}
getch();
}
else
if(sel==23)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 2 by Do While loop is : ");
printf("\n\n");
i=1;
do
{ g=1;
do
{ printf(" ");
g++;
}while(g<=n-i+1);
j=1;
do
{
if(j%2==0)
{
printf(" ");
}
else
{
printf("*");
}
j++;
}while(j<=(2*i)-1);
printf("\n");
i++;
}while(i<=n);
getch();
}
else
printf("\n\t Invalid Input!!");
break;
case 3:
clrscr();
printf("\n\t Enter 31 to print this pattern using for loop...");
printf("\n\t Enter 32 to print this pattern using While loop...");
printf("\n\t Enter 33 to print this pattern using Do While loop...");
printf("\n\n\t Enter Your Choice : ");
scanf("%d",&sel);
if(sel==31)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 3 by for loop is : ");
printf("\n\n");
for(i=1;i<=n;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
printf(" ");
}
printf("\n");
}
getch();
}
else
if(sel==32)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 3 by While loop is : ");
printf("\n\n");
i=1;
while(i<=n)
{
j=1;
while(j<=i)
{
printf("%d",j);
printf(" ");
j++;
}
printf("\n");
i++;
}
getch();
}
else
if(sel==33)
{
clrscr();
{
printf("%d",j);
printf(" ");
j++;
}while(j<=i);
printf("\n");
i++;
}while(i<=n);
getch();
}
else
printf("\n\t Invalid Input!!");
break;
case 4:
clrscr();
printf("\n\t Enter 41 to print this pattern using for loop...");
printf("\n\t Enter 42 to print this pattern using While loop...");
printf("\n\t Enter 43 to print this pattern using Do While loop...");
printf("\n\n\t Enter Your Choice : ");
scanf("%d",&sel);
if(sel==41)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 4 by for loop is : ");
printf("\n\n");
printf("1");
for(i=2;i<=n;i++)
{
a=pow(11,i);
printf("\n%d",a);
}
getch();
}
else
if(sel==42)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 4 by While loop is : ");
printf("\n\n");
printf("\n1");
i=2;
while(i<=n)
{
a=pow(11,i);
printf("\n%d",a);
i++;
}
getch();
}
else
if(sel==43)
{
clrscr();
printf("\n\t Enter the number of rows - ");
scanf("%d",&n);
printf("\n\n The pattern 4 by DO While loop is : ");
printf("\n\n");
printf("\n1");
i=2;
do
{
a=pow(11,i);
printf("\n%d",a);
i++;
}while(i<=n);
getch();
}
else
printf("\n\t Invalid Input!!");
break;
default:
clrscr();
printf("\n\n\t\t Invalid Input !!! ");
clrscr();
printf("\n\n\t\t Thank you for using this program");
getch();
}getch();
}
Output :
scanf("%d",&num);
printf("\n\t %d",a);
printf("\t %d",b);
do
{
c=a+b;
a=b;
b=c;
printf("\t %d",c);
sum=sum+c;
}while(c<num);
sum=sum+1;
printf("\n\n\t The sum of series is %f ",sum);
getch();
break;
case 3:
clrscr();
printf("\n\tEnter the number of terms you want in series : ");
scanf("%d",&num);
printf("\n\tEnter the value of x : ");
scanf("%d",&x);
printf("\n\n");
for(i=1;i<=((2*num)-1);i=i+2)
{
c++;
for(a=1;a<=i;a++)
fact=fact*a;
nume=pow(x,i);
if((c%2)==0)
nume=nume*-1;
else
nume=nume*1;
printf("\t %15.0f/%ld ",nume,fact);
sum=sum+(nume/fact);
fact=1;
}
printf("\n\n\t The sum of series is : %1.3f ",sum);
getch();
break;
case 4:
clrscr();
printf("\n\tEnter the number of terms you want in series : ");
scanf("%d",&num);
printf("\n\n");
printf("\t1");
j=1;
while(j<=(num-1))
{
for(a=1;a<=j;a++)
fact=fact*a;
printf("\t+\t%1.0f/%ld",dummy,fact);
sum=sum+(dummy/fact);
fact=1;
j++;
}
sum=sum+1;
printf("\n\n\t The sum of series is : %1.3f ",sum);
getch();
break;
case 5:
clrscr();
printf("\n\tEnter the no. upto which you want to print prime no series :");
scanf("%d",&num);
printf("\n\n\t1");
for(i=2;i<=num;i++)
{
for(j=2;j<=(i-1);j++)
{
x=i%j;
if(x==0)
break;
}
if(x!=0)
printf("\t%d",i);
x=0;
}
break;
case 6:
clrscr();
printf("\n\n\t Enter any year : ");
scanf("%d",&num);
if((num%4)==0)
printf("\n\t The Year you entered is a leap year");
else
printf("\n\t The year you entered is not a leap year");
getch();
break;
default :
printf("\n\t Invalid Entry!!!");
}
getch();
}
Output :
break;
case 5:
clrscr();
printf("\n\n\tEnter any string\n\t");
gets(ab);
for(i=0;i<=100;i++);
{
if(ab[i]==65 || ab[i]==97 || ab[i]==69 || ab[i]==101 || ab[i]==73 || ab[i]==105 ||
ab[i]==79 || ab[i]==111 || ab[i]==85 || ab[i]==117 )
vowels=vowels+1;
if((ab[i]>=65 && ab[i]<=90 )||(ab[i]>=97 && ab[i]<=122))
consonants=consonants+1;
}
consonants=consonants-vowels;
printf("\n\t The number of vowels in the entered String is : %d",vowels);
printf("\n\t The number of consonants in the entered String is : %d",consonants);
getch();
break;
case 6:
clrscr();
printf("\n\t Enter any string : ");
scanf("%s",&string1);
while(string1[i]!='\0')
{
i++;
}
for(a=0;a<=(i-2);a++)
{
for(b=0;b<=(i-2)-a;b++)
{
if (string1[b]>string1[b+1])
{
n=string1[b];
string1[b]=string1[b+1];
string1[b+1]=n;
}}}
printf("\n\n\t");
for(a=0;a<=i;a++)
printf("%c",string1[a]);
getch();
break;
default :
printf("\n\n\t Invalid Key press !!! ");
}
getch();
Prakritee John Page 22
BCA 1st YEAR 2021 - 2022
}
Output :
for(i=0;i<=9;i++)
printf("\t%d",a[i]);
getch();
break;
case 2:
clrscr();
for(i=0;i<=9;i++)
{
printf("\n\t Enter any value : ");
scanf("%d",&a[i]);
clrscr();
}
printf("\n\n\t Enter any value to find its position in the array : ");
scanf("%d",&j);
for(i=0;i<=9;i++)
{
if(j==a[i])
k=i+1;
}
if(k==-1)
printf("\n\t Element not found ");
else
printf("\n\t Position of element in the array is %d ",k);
getch();
break;
case 3:
clrscr();
clrscr();
for(i=0;i<=9;i++)
{
printf("\n\t Enter any value : ");
scanf("%d",&a[i]);
clrscr();
}
printf("\n\n\t Enter any value to find its position in the array : ");
scanf("%d",&x);
fi=0;
la=9;
while(fi<=la && posi==-1)
{
mid=(fi+la)/2;
if(a[mid]==x)
posi=mid+1;
if(a[mid]<x)
fi=mid+1;
else
la=mid-1;
}
if(posi==-1)
printf("\n\t Number not found ");
else
printf("\n\t Position of element in the array is %d",posi);
getch();
break;
default:
printf("\n\n\t Invalid Entry !!!");
}
getch();
}
Output :
#include<stdio.h>
#include<conio.h>
void main()
{
float month[31],ave,sum=0,st;
int x,i,j,k;
clrscr();
printf("\n\n\t Enter number of days in the month : ");
scanf("%d",&x);
for(i=0;i<=x-1;i++)
{
printf("\n\t Enter temperature : ");
scanf("%f",&month[i]);
clrscr();
}
for(i=0;i<=x-1;i++)
{
sum=sum+month[i];
}
ave=sum/x;
for(j=0;j<=x-2;j++)
{
for(k=0;k<=(x-2)-j;k++)
{
if(month[k]>month[k+1])
{
st=month[k];
month[k]=month[k+1];
month[k+1]=st;
}
}
}
printf("\n\n\t The average temperature of month is %4.2f ",ave);
printf("\n\n\t The hottest day of month is %4.2f",month[x-1]);
printf("\n\n\t The coolest day of month is %4.2f",month[0]);
getch();
}
Output :
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&b[i][j]);
}
}
printf("\n\t The first matrix is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",a[i][j]);
}
printf("\n\n");
}
printf("\n\t The first matrix is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",a[i][j]);
}
printf("\n\n");
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
c[i][j]=a[i][j]+b[i][j];
}
}
printf("\n\t The sum of both martices is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",c[i][j]);
}
printf("\n\n");
}
getch();
break;
case 2:
clrscr();
printf("\n\n Enter the elements of first Matrix ");
getch();
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&a[i][j]);
}
}
clrscr();
printf("\n\n Enter the elements of second Matrix ");
getch();
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&b[i][j]);
}
}
printf("\n\t The first matrix is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",a[i][j]);
}
printf("\n\n");
}
printf("\n\t The second matrix is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",b[i][j]);
}
printf("\n\n");
}
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
c[i][j]=a[i][j]-b[i][j];
}
}
printf("\n\t The sum of both martices is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",c[i][j]);
}
printf("\n\n");
}
getch();
break;
case 3:
clrscr();
printf("\n\n Enter the elements of first Matrix ");
getch();
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&a[i][j]);
}
}
clrscr();
printf("\n\n Enter the elements of second Matrix ");
getch();
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&b[i][j]);
}
}
clrscr();
printf("\n\t The first matrix is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",a[i][j]);
}
printf("\n\n");
}
}
printf("\n\n");
}
printf("\n\t The transpose of Entered matrix is : \n\n");
for(i=0;i<=2;i++)
{ for(j=0;j<=2;j++)
printf("%d\t",a[j][i]);
printf("\n");
}
getch();
break;
case 6:
printf("\n\n Enter the elements of Matrix ");
getch();
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
clrscr();
printf("\n\t Enter any value : ");
scanf("%d",&a[i][j]);
}
}
clrscr();
printf("\n\t The matrix you entered is : \n\n");
for(i=0;i<=2;i++)
{
for(j=0;j<=2;j++)
{
printf("\t %d",a[i][j]);
}
printf("\n\n");
}
printf("\n\t The sum of diagonal elements of Entered matrix is : \n\n");
for(i=0;i<=2;i++)
{ for(j=0;j<=2;j++)
{ if(i==j)
sum1=sum1+a[i][j];
if((i+j)==2)
sum2=sum2+a[i][j];
}
}
printf("\n\tsum1=%d",sum1);
printf("\n\tsum2=%d",sum2);
getch();
break;
default :
getch();
printf("\n\n\t Invald Entry !!!");
}
getch();
}
Output :
nume=pow(x,i);
if((c%2)==0)
nume=nume*-1;
else
nume=nume*1;
printf("\t %15.0f/%ld ",nume,fact);
sum=sum+(nume/fact);
fact=1;
}
return(sum);
}
float fabo(int x)
{
float sum=0;
int a,b,c;
a=0;
b=1;
printf("\n\t %d",a);
printf("\t %d",b);
do
{
c=a+b;
a=b;
b=c;
printf("\t %d",c);
sum=sum+c;
}while(c<x);
sum=sum+1;
return(sum);
}
long int fact(int a)
{
int i,j,x=1;
for(i=1;i<=a;i++)
x=x*i;
return(x);
}
void main()
{
float sum;
int choice,num;
long int back;
clrscr();
printf("\n\tEnter 1 to find Factaorial of given number");
printf("\n\tEnter 2 to print Fabonacci Series");
printf("\n\tEnter 3 for printing Sin series upto n terms and its sum");
printf("\n\tEnter 4 for printing exponential series upto n terms and its sum");
printf("\n\tEnter 5 for printing natural number series upto n terms and its sum");
printf("\n\n\t Enter your choice : ");
scanf("%d",&choice);
switch(choice)
{
case 1:
clrscr();
printf("\n\tEnter any number to find its factorial : ");
scanf("%d",&num);
back=fact(num);
printf("\n\n\t Factorial of entered number is : %ld",back);
getch();
case 2:
clrscr();
sum=0;
printf("\n\t Enter the n'th term of the series : ");
scanf("%d",&num);
sum=fabo(num);
printf("\n\n\t The sum of series is %10.0f ",sum);
getch();
case 3:
clrscr();
sum=0;
printf("\n\tEnter the number of terms you want in series : ");
scanf("%d",&num);
sum=sine(num);
printf("\n\n\t The sum of series is : %1.3f ",sum);
getch();
case 4:
clrscr();
sum=0;
printf("\n\tEnter the number of terms you want in series : ");
scanf("%d",&num);
sum=expo(num);
printf("\n\n\t The sum of series is : %1.3f ",sum);
getch();
case 5:
clrscr();
sum=0;
printf("\n\t Enter the n'th term of the series : ");
scanf("%d",&num);
sum=natural(num);
printf("\n\n\t The sum of series is %10.0f ",sum);
getch();
default :
clrscr();
printf("\n\t Invalid Entry !!!");
getch();
}
getch();
}
Output :
if(p>x.max)
printf("\n\t Invalid Input !!!");
getch();
}
while(q>=x.max)
{
printf("\n\tEnter the marks obtained in %s : ",x.s2);
scanf("%d",&q);
if(q>x.max)
printf("\n\t Invalid Input !!!");
getch();
}
while(r>=x.max)
{
printf("\n\tEnter the marks obtained in %s : ",x.s3);
scanf("%d",&r);
if(r>x.max)
printf("\n\t Invalid Input !!!");
getch();
}
clrscr();
x.obt=p+q+r;
printf("\n\t Roll number : %d",x.roll);
printf("\n\n\t Name of student : %s",x.name);
printf("\n\n\t %-18s: %d",x.s1,p);
printf("\n\n\t %-18s: %d",x.s2,q);
printf("\n\n\t %-18s: %d",x.s3,r);
printf("\n\n\t maximum marks : %d",x.max);
printf("\n\n\t minimum marks : %d",x.min);
printf("\n\n\t obtained marks : %d",x.obt);
if(x.obt<((3*x.max)/3) || p<x.min || q<x.min || r<x.min)
printf("\n\n\t You are Fail ");
else
printf("\n\n\t Congratulations !! You are pass ");
getch();
clrscr();
printf("\n\n\n\n\tDo you want to countinue press y\n");
option=getch();
}
getch();
}
Output :
printf("%lf",d);
printf("\n");
complex_print(d);
getch();
}
struct complex complex_set(double r,double i)
{ struct complex temp;
temp.real=r;
temp.imag=i;
return (temp);
}
void complex_print(struct complex t)
{ printf("%lf %lf",t.real,t.imag);
}
struct complex complex_add(struct complex c1,struct complex c2)
{ struct complex temp;
temp.real=c1.real+c2.real;
temp.imag=c1.imag+c2.imag;
return (temp);
}
struct complex complex_sub(struct complex c1,struct complex c2)
{ struct complex temp;
temp.real=c1.real-c2.real;
temp.imag=c1.imag-c2.imag;
return (temp);
}
struct complex complex_mul(struct complex c1,struct complex c2)
{ struct complex temp;
temp.real=c1.real*c2.real;
temp.imag=c1.imag*c2.imag;
return (temp);
}
struct complex complex_div(struct complex c1,struct complex c2)
{ struct complex temp;
temp.real=c1.real/c2.real;
temp.imag=c1.imag/c2.imag;
return (temp);
}
Output :
Practical No. 16: Define union Emp having data members :- One
integer , One float and one single dimension character array. Declare
union variable in main and test the union variable.
Program :
#include<stdio.h>
#include<conio.h>
void main()
{
union emp
{ int x;
float y;
char z[10];
};
union emp a;
clrscr();
printf("\n\tEnter any integer value : ");
scanf("%d",&a.x);
printf("\n\tEnter any float value : ");
scanf("%f",&a.y);
printf("\n\tEnter any String : ");
scanf("%s",&a.z);
clrscr();
printf("\n\n\t Integer : %d",a.x);
printf("\n\t String : %s",a.z);
printf("\n\t Float : %.2f",a.y);
getch();
}
Output :
}
Out put :
Practical No. 19: Write program to find biggest number among three
numbers using pointer and function.
Program :
#include<stdio.h>
#include<conio.h>
int gre(int *x,int *y,int *z)
{
if(*x>*y && *x>*z)
return(*x);
else if(*y>*z)
return(*y);
else
return(*z);
}
void main()
{
int a,b,c,*x,*y,*z,i;
clrscr();
printf("\n\tEnter first number : ");
scanf("%d",&a);
printf("\n\tEnter second number : ");
scanf("%d",&b);
printf("\n\tEnter third number : ");
scanf("%d",&c);
x=&a;
y=&b;
z=&c;
i=gre(x,y,z);
printf("\n\n\tThe Greatest of all the three numbers is : %d",i);
getch();
}
Output :