6. Write a program to find the biggest of the three numbers.
#include<stdio.h>
#include<conio.h>
void main()
{
int a,b,c;
clrscr();
printf("enter a,b,c");
scanf("%d%d%d",&a,&b,&c);
if(a>b && a>c)
printf("a is ..");
else if(b>a && b>c)
printf("b..");
else
printf("c..");
getch();
}
7. Write a program to delete the number from specific location.
#include<stdio.h>
#include<conio.h>
void main()
{
int no[10],x,loc,ch;
clrscr();
printf("how many nos will u like to enter?");
scanf("%d",&ch);
for(x=0;x<ch;x++)
{
printf("enter %d value==",x+1);
scanf("%d",&no[x]);
}
printf("enter the location to delete");
scanf("%d",&loc);
if(ch>=10)
{
printf("sorry");
}
else
{
for(x=loc-1;x<ch;x++)
{
no[x]=no[x+1];
}
ch=ch-1;
printf("after deleting");
for(x=0;x<ch;x++)
{
printf("%d",no[x]);
}
}
getch();
}
8. Write a program to perform the mechanism of reversing the number.
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
rev();
getch();
}
rev()
{
int x=0,y,no,temp;
printf("enter the no");
scanf("%d",&no);
temp=no;
while(no>=1)
{
y=no%10;
x=(x*10)+y;
no=no/10;
}
printf("rev is %d",x);
return(0);
}
9. Write a program to find the number even is or not through switch-case statement.
#include<stdio.h>
#include<conio.h>
void main()
{
int a;
clrscr();
printf("enter a,b,c");
scanf("%d",&a);
switch(a%2)
{
case 0:
printf("even");
break;
default:
printf("odd");
}
getch();
}
10. Write a program to print matrix.
#include<stdio.h>
#include<conio.h>
void main()
{
int x[3][3]={1,2,3,4,3,2,1,5,4};
int y[3][3]={9,8,7,6,5,4,3,2,1};
int z[3][3];
int a,b;
clrscr();
for(a=0;a<3;a++)
{
for(b=0;b<3;b++)
{
z[a][b]=x[a][b]+y[a][b];
printf("%2d",z[a][b]);
}
printf("\n");
}
getch();
}
Made By: Chaudhary Amit V.
Comments
Post a Comment