#include
#include
main()
{
clrscr();
int a=10,b=20;
void swapr(int*,int*);
clrscr();
printf("\nEnter The Vale Of A & B:=");
scanf("%d%d",&a,&b);
printf("\n\t A=%d",a);
printf("\n\t B=%d",b);
swapr(a,b);
printf("\n\n\tAfter Sweping The Value");
printf("\n\n\t A=%d",a);
printf("\n\t B=%d",b);
getch();
}
void swapr(int,int)
int *x,*y;
{
int *z=0;
*z=*x;
*x=*y;
*y=*z;
}
Program to swap the numbers by Call By Referance in C
Program to create rectangle
#include
main()
{
int driver,mode,i=10;
driver=0;
mode=VGAHI;
initgraph(&driver,&mode,"\\tc\\bgi");
for(i=10;i<=100;i+10)
{
rectangle(254,236,456,368);
clearviewpart();
delay(500);
moveto(i,i);
}
getch();
restorecrtmode();
closegraph();
}
Program to Show Pointer example by using %u
main()
{
int num[3];
int n,i,*j;
clrscr();
printf("enter the number:-");
scanf("%d",&n);
j=&num[0];
for(i=0;i<=n;i++)
{
printf("\naddress=%u",j);
printf("\n element=%d",i);
j++;
}
getch();
}
Program to calculate Total, Performance and average of given numbers in c
main()
{
int match1, match2, pr, tot;
clrscr();
printf("\n enter match1, match2");
scanf("%d %d", &match1,&match2);
tot=match1 + match2;
printf("\n total= %d", tot);
pr=tot/2;
printf("\n percentage=%d", pr);
if(pr> 100)
{
printf(" normal performance");
}
if(pr<50)
printf("\n Your Very bad");
getch();
}
Program to Frind the biggest and smallest number from given array set
main()
{
int array[]={5,66,76,34,23,51,94,18,35};
int i,count,large=1,small=32767,n;
clrscr();
for(count=0;count<=9;count++)
{
printf("\n %d-------> %d",count,array[count]);
}
for(count=0;count<=9;count++)
{
if(large < array[count])
{
large = array[count];
}
if(small >= array[count])
{
small=array[count];
}
}
printf("\n largest no in the array is %d",large);
printf("\n smallest no in the array is %d",small);
getch();
}