C Programming
1.Write a c program to print ‘HELLO WORLD’.
Answer. #include<stdio.h>
int main()
{
printf("HELLO WORLD");
return 0;
}
2.Write a c program to find out addition of two number.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
a=5;
b=3;
c=a+b;
printf("addition is=%d",c);
return 0;
}
3.Write a c program to find out substraction of two number.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
a=10;
b=7;
c=a-b;
printf("substraction is=%d",c);
return 0;
}
4.Write a c program to find out multiplication of two number.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
a=5;
b=4;
c=a*b;
printf("multiplication is=%d",c);
return 0;
}
5.Write a c program to find out division of two number.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
a=5;
b=3;
c=a/b;
printf("division is=%d",c);
return 0;
}
6.Write a c program to find out the area of triangle.
Answer. #include<stdio.h>
int main()
float a,b,h;
printf("enter the value of base and hight");
scanf("%d%d",&b,&h);
a=0.5*b*h;
printf("area of triangle is=%d",a);
return 0;
7.Write a c program to find out the area of squre.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter the value of base and hight");
scanf("%d%d",&b,&h);
a=b*b;
printf("area of squre is=%d",a);
return 0;
8.Write a c program to find out the area of rectangle.
Answer. #include<stdio.h>
int main()
Int a,b,h;
printf("enter the value of base and hight");
scanf("%d%d",&b,&h);
a=*b*h;
printf("area of rectangle is=%d",a);
return 0;
9.Write a c program to find out the area of circle.
Answer. #include<stdio.h>
int main()
float a,r;
printf("enter the value of radius");
scanf("%d%d",&r);
a=3.141*r*r;
printf("area of circle is=%d",a);
return 0;
10. Write a c program to enter two no. and swap them using third
variable.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
printf("enter any two no");
scanf("%d%d",&a,&b);
printf("after swapping");
c=a;
a=b;
b=c;
printf("%d%d",a,b);
return 0;
}
11. write a c program to enter two no and swap them without using
third variable.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter any two no");
scanf("%d%d",&a,&b);
printf("after swapping");
a=a+b;
b=a-b;
a=a-b;
printf("%d%d",a,b);
return 0;
12.Write a c program to enter a no. and multiplay them.
Answer. #include<stdio.h>
int main()
Int a,b,m;
printf(“enter any two no”);
scanf(“%d%d”,&a,&b);
m=a*b;
printf("multiplication=%d",m);
return 0;
13.Write a c program to enter the temp in farenhight and convert into
celcious.
Answer. #include<stdio.h>
int main()
float c,f;
printf("enter the tempreture in farenhight");
scanf("%f",f);
c=(f-32)*1.8;
printf("values of the tempreture in celcious=%f",c);
return 0;
14.Write a c program to enter the temp in celcious and convert into
farenhight.
Answer. #include<stdio.h>
int main()
{
float c,f;
printf("enter the tempreture in celcious");
scanf("%f",f);
f=(c+32)*0.52;
printf("values of the tempreture in farenhight=%f",f);
return 0;
15. Write a c program to find out to enter two float number and find
out the smallest one.
Answer. #include<stdio.h>
int main()
float a,b;
printf("enter any two no");
scanf("%f%f",&a,&b);
if(a<b)
printf("a is smallest");
else
{
printf("b is smallest");
return 0;
16.Write a c program to visualise different unary operation.
Answer. #include<stdio.h>
int main()
int a,b,c,d,e;
a=5;
b=a++;
c=a--;
d=a++;
e=--a;
printf("%d%d%d%d%d",a,b,c,d,e);
return 0;
17.Write a c program to enter a no. and find out the greatest one
using conditional statement.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter any two no");
scanf("%d%d",&a,&b);
(a>b)?printf("a is greatest"):printf("b is greatest");
return 0;
18.Write a c program to enter your age and check wether ur eligible
for voating or not.
Answer. #include<stdio.h>
int main()
int age;
printf("enter your age");
scanf("%d",&age);
(age>=18)?printf("eligibile for voating"):printf("not
eligible for voating");
return 0;
}
19.Write a c program to enter three no. and findout the greatest
among them.
Answer. #include<stdio.h>
int main()
int a,b,c;
printf("enter any no");
scanf("%d%d%d",&a,&b,&c);
if(a>b&&a>c)
printf("a is greatest");
else if(b>a&&b>c)
printf("b is greatest");
else
printf("c is greatest");
}
return 0;
20.Write a c program to enter 3 no findout the smallest one using
logical expression.E
Answer. #include<stdio.h>
int main()
int a,b,c;
printf("enter any three no");
scanf("%d%d%d",&a,&b,&c);
if(a<b !! a<c)
printf("a is smallest");
else if(b<a !! b<c)
printf("b is smallest");
else
{
printf("c is smallest");
return 0;
21.write a c program to enter a no. and findout the quotient and
remender.
Answer. #include<stdio.h>
int main()
int x,y,z,t;
printf("enter any three no");
scanf(“%d%d%d”,&x,&y);
t=x%y;
z=x/y;
printf(“remender is=%d”,t);
printf(“quotient is=%d”,z);
return 0;
22.Write a c prigram to enter two no. and check their equality.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter any two no");
scanf("%d%d",&a,&b);
if(a==b)
printf("both are equal");
else
printf("not equal");
return 0;
23.write a c program to demonstate the use of sizeof operator.
Answer. #include<stdio.h>
int main()
{
char a;
int b;
float c;
double d;
printf("%d%d",sizeof(char),sizeof(a));
printf("\n%d%d",sizeof(int),sizeof(b));
printf("\n%d%d",sizeof(float),sizeof(c));
printf("\n%d%d",sizeof(double),sizeof(d));
return 0;
24.write a c program to enter the year and check weather it is leap
year or not.
Answer. #include<stdio.h>
int main()
int year;
printf("enter a year");
scanf("%d",&year);
if(year%4==0 && year%100!=year%400==0)
{
printf("year is leap year");
else
printf("year is not leap year");
return 0;
25.write a c program to demonstate the use of assignment operator.
Answer. #include<stdio.h>
int main()
char t;
t=getchar();
if(t>=65 && t<97)
printf("%c",(t+1));
if(t>=97 && t<122)
{
printf("%c",(t-32));
return 0;
26.write a c program to display the use of bitwise AND operator.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter the value of a&b");
scanf("%d%d",&a,&b);
printf("%d",a&b);
return 0;
27.write a c pogram to display the use of bitwise OR operator.E
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter the value of a&b");
scanf("%d%d",&a,&b);
printf("%d",a!b);
return 0;
28.write a c pogram to display the use of bitwise X-OR operator.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter the value of a&b");
scanf("%d%d",&a,&b);
printf("%d",a^b);
return 0;
29.write a c program to enter a no. and shift it 3 places using left shift
operator.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter value of a");
scanf("%d",&a);
b=a<<3;
printf("%d",b);
return 0;
30.write a c program to enter a no. and shift it 3 places using right
shift operator.
Answer. #include<stdio.h>
int main()
int a,b;
printf("enter value of a");
scanf("%d",&a);
b=a>>3;
printf("%d",b);
return 0;
31.Write a c program to display arithmatic expression.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
printf(“enter values of a and b”);
scanf(“%d%d”,&a,&b);
c=a*b;
printf(" value of c is=%d",c);
return 0;
}
32.Write a c program to display logical expression.
Answer. #include<stdio.h>
int main()
{
int a,b,c,k;
printf(“enter value of a,b,c”);
scanf(“%d%d%d”,&a,&b,&c);
k=a>b!!a>c;
printf(" value of c is=%d",k );
return 0;
}
33.Write a c program to display relational expression.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
printf(“enter values of a and b”);
scanf(“%d%d”,&a,&b);
c=a>=b;
printf(" value of c is=%d",c);
return 0;
}
34.Write a c program to display conditional expression.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
printf(“enter values of a and b”);
scanf(“%d%d”,&a,&b);
(a>b)?printf(“a is greatest”):printf(“b is greatest”);
return 0;
}
35.Write a c program to visualise different unary expresion.
Answer. #include<stdio.h>
int main()
int a,b,c,d,e;
a=5;
b=a++;
c=a--;
d=a++;
e=--a;
printf("%d%d%d%d%d",a,b,c,d,e);
return 0;
36.Write a c program to find out binary expression.
Answer. #include<stdio.h>
int main()
{
int a,b,c;
printf(“enter any two no”);
scanf(“%d%d”,&a,&b);
c=a+b;
printf("addition is=%d",c);
return 0;
}
37.write a c program to enter a no. and check weather it is positive or
negative.
Answer. #include<stdio.h>
int main()
int a;
printf("enter a no");
scanf("%d",&a);
if(a>0)
printf("a is postive");
If(a<0)
printf("a is negative");
return 0;
38.write a c program to enter a no. and check weather it is even or
odd no.
Answer. #include<stdio.h>
int main()
int a;
printf("enter a no");
scanf("%d",&a);
if(a%2==0)
{
printf("a is even no");
if(a%2!=0)
printf("a is odd no");
return 0;
39.write a c program to enter a year and check weather it is leap year
or not.
Answer. #include<stdio.h>
int main()
int year;
printf("enter a year");
scanf("%d",&year);
if(year%4==0)
printf("year is leap year");
}
if(year%4!=0)
printf("year is not leap year");
return 0;
40.write a c program to enter a no. and check weather it is single digit
or not.
Answer. #include<stdio.h>
int main()
int a;
printf("enter a no");
scanf("%d",&a);
if(a<10)
printf("a is single digit");
if(a>10)
{
printf("a is not single digit");
return 0;
41.Write a c program to enter your age and check wether ur eligible
for voating or not.
Answer. #include<stdio.h>
int main()
int age;
printf("enter your age");
scanf("%d",&age);
if(age>=18)
printf(“eligible for voating”);
if(age<18)
{
printf(“not eligible for voating”);
return 0;
42.write a c program to enter a no. and check weather it is positive or
negative.
Answer. #include<stdio.h>
int main()
int a;
printf("enter a no");
scanf("%d",&a);
if(a>0)
printf("a is postive");
else
printf("a is negative");
}
return 0;
43.Write a c program to enter your age and check wether you are
eligible for voating or not.
Answer. #include<stdio.h>
int main()
int age;
printf("enter your age");
scanf("%d",&age);
if(age>=18)
printf(“eligible for voating”);
else
printf(“not eligible for voating”);
return 0;
}
44.write a c program to enter a no. and check weather it is single digit
or not.
Answer. #include<stdio.h>
int main()
int a;
printf("enter a no");
scanf("%d",&a);
if(a<10)
printf("a is single digit");
else
printf("a is not single digit");
return 0;
45.write a c program to enter a year and check weather it is leap year
or not.
Answer. #include<stdio.h>
int main()
int year;
printf("enter a year");
scanf("%d",&year);
if(year%4==0)
printf("year is leap year");
else
printf("year is not leap year");
return 0;
46.write a c program to visualize the use of if else if ladder.
Answer. #include<stdio.h>
int main()
{
int x,y,z;
printf("enter any three no");
scanf("%d%d%d",&x,&y,&z);
if(x<y !! x<z)
printf("x is smallest");
else if(y<x !! y<z)
printf("y is smallest");
else
printf("z is smallest");
return 0;
47.Write a c program to display different days of week.
Answer. #include<stdio.h>
int main()
{
int x;
printf("enter the option");
scanf("%d",&x);
switch (x)
case 1:
printf("sunday");
break;
case 2:
printf("monday");
break;
case 3:
printf("thuesday");
break;
}
case 4:
printf("wednesday");
break;
case 5:
printf("thursday");
break;
case 6:
printf("fridayday");
break;
case 7:
printf("saturday");
break;
}
default:
printf("\ninvalid option");
return 0;
48.Write a c program to demonstate the use of nested if statement.
Answer. #include<stdio.h>
int main()
int i=10;
if(i==10)
if(i<15)
printf("i is less than 15");
if(i<12)
{
printf("i is less than 12 too");
else
printf("i is greater than 15");
return 0;
49. Write a c program to display 1 to 10 using while loop.
Answer. #include<stdio.h>
int main()
int i=1;
while(i<=10)
printf("%d",i);
i=i+1;
}
return 0;
50.write a c program to display the output 2 3 5 6 7 8 10.
Answer.#include<stdio.h>
int main()
int a=2;
while(a<=10)
if(a!=4 && a!=6 && a!= 9)
Printf(“%d”,a);
a=a+1;
return 0;
51. Write a c program to display 1 to 50 using for loop.
Answer. #include <stdio.h>
int main()
{
int x;
for (x=1;x<=50;x++)
printf ("\n%d", x);
return 0;
52.Write a c program to enter a no. and find out the factorial of that
no.
Answer. #include<stdio.>
int main()
int a;
long int f=1;
printf("enter a no");
scanf("%d",&a);
while(a>0)
f=f*a;
a=a-1;
printf("factorial is=%d",f);
return 0;
53. Write a c program to enter a no. and find out the reverse of that
no.
Answer. #include<stdio.h>
int main()
int a,b,c=0;
printf("enter a no");
scanf("%d",&a);
while(a>0)
b=a%10;
c=(c*10)+b;
a=a/10;
printf("reverse of the no is=%d",c);
return 0;
54. Write a c program to enter a no. and check weather the no. is
ammstrong no. or not.
Answer. #include<stdio.h>
int main()
int a,b,c=0,d;
printf("enter a no");
scanf("%d",&a);
d=a;
while(a>0)
b=a%10;
c=c+(b*b*b);
a=a/10;
if(c==d)
printf("ammstrong no");
}
else
printf("not ammstrong no");
return 0;
55. Write a c program to enter a no. and check weather the no. is
prime no. or not.
Answer. #include<stdio.h>
int main()
int a,b,c=0;
printf("enter a no");
scanf("%d",&a);
for(b=1;b<=a;b++)
if(a%b==0)
c=c+1;
}
if(c==2)
printf("prime no");
else
printf("not prime no");
return 0;
56. Write a c program to enter a no. and check weather it is perfect
no. or not.
Answer. #include<stdio.h>
int main()
int a,b,c=0;
printf("enter a no");
scanf("%d",&a);
for(b=1;b<a;b++)
if(a%b==0)
c=c+b;
if(c==a)
printf("perfect no");
else
printf("not perfect no");
return 0;
57.Write a c program to enter a no and check weather it is special no
or not.
Answer. #include<stdio.h>
int main()
int a,b,c;
printf("enter any no");
scanf("%d",&a);
b=a%10;
c=b*b*b;
if(c==a)
printf("special no");
else
printf("not special no");
return 0;
58.Write a c program to enter a no. and check wether it is pallendrum
no. or not.
Answer. #include<stdio.h>
int main()
int a,b,c=0,d;
printf("enter a no");
scanf("%d",&a);
d=a;
while(a>0)
b=a%10;
c=(c*10)+b;
a=a/10;
if(c==d)
printf("pallendrum no");
else
printf("not pallendrum no");
}
return 0;
59.Write a c program to print the odd no between 1 to 10 and find out
their average.
Answer. #include<stdio.h>
int main()
int a,b=0,c=0,d;
for(a=1;a<=10;a++)
if(a%2!=0)
b=b+a;
c=c+1;
d=b/c;
printf("average of add no is=%d",d);
return 0;
}
60. Write a c program to find sum and product of digit of a no.
Answer. #include<stdio.h>
int main()
int a,b,c=0,d=1;
printf("enter a no");
scanf("%d",&a);
while(a>0)
b=a%10;
c=c+b;
d=d*b;
a=a/10;
printf("sum of digit the no is=%d",c);
printf("\nproduct of digit of no is=%d",d);
return 0;
61.Write a c program to print leap year between 2000 to 2024.
Answer. #include<stdio.h>
int main()
int year;
for(year=2000;year<=2024;year++)
if(year%4==0)
printf("\n%d",year);
return 0;
62.write a c program to enter two no. find out their lcm and gcd.
Answer. #include<stdio.h>
int main()
int a,b,c,d,r;
printf("enter any two no");
scanf("%d%d",&a,&b);
c=a;
d=b;
r=d%c;
while(r!=0)
d=c;
c=r;
r=d%c;
printf("gcd is=%d",c);
printf("\nlcm is=%d",(a*b)/c);
return 0;
63.Write a c program to demonstate the use of pass by value.
Answer. #include<stdio.h>
int main()
int a=10,b=20;
printf("%d%d",a,b);
pass(a,b);
printf("%d%d",a,b);
return 0;
pass(int a,int b)
int c;
c=a;
a=b;
b=c;
printf("%d%d",a,b);
64. Write a c program to demonstate use of pass by address.
Answer. #include<stdio.h>
int main()
int a=10,b=20;
printf("%d%d",a,b);
pass(a,b);
printf("%d%d",a,b);
return 0;
}
pass(int *a,int *b)
int c;
c=*a;
*a=*b;
*b=c;
printf("%d%d",a,b);
65. Write a c program to display 1 to 20 using do-while loop.
Answer. #include<stdio.h>
int main()
int x=1;
do
printf("\n%d",x);
x=x+1;
}while(x<=20);
return 0;
}
66.Write a c program to demonstate use of continue statement.
Answer. #include<stdio.h>
int main()
int i=1;
for(i=1;i<=10;i++)
if(i==3)
continue;
printf("%d",i);
return 0;
67.write a c program to display exit statement.
Answer.
Answer.#include<stdio.h>
#include<stdllib.h>
Int main()
Int a;
For(a=5;a<=15;a++)
If(a==5)
Exit();
Printf(“%d”,a);
Printf(“out of loop”);
Return 0;
68.write a c peogram to display stars in manner.
Answer.#include<stdio.h>
int main()
{
int i,j;
printf(“enter the design”);
scanf(“%d”,&i,&j);
for(i=3;i<=3;i++)
for(j=1;j<=i;j++)
printf(“*”);
printf(“\n”);
return 0;
69.write a c program to display ABC in manner.
Answer. #include<stdio.h>
int main()
int i,j;
printf(“enter the design”);
scanf(“%d”,&i,&j);
for(i=65;i<=67;i++)
for(j=65;j<=i;j++)
printf(“%c”,j);
printf(“\n”);
return 0;
70. write a c program to display 123 in manner.
Answer. #include<stdio.h>
int main()
int i,j;
printf(“enter the design”);
scanf(“%d”,&i,&j);
for(i=1;i<=3;i++)
for(j=1;j<=i;j++)
{
printf(“%d”,j);
printf(“\n”);
return 0;
71.write a c program to ener your college name and findout their
length.
Answer.#include<stdio.h>
#include<string.h>
int main()
char a[25];
printf(“enter your name”);
gets(a);
printf(“%d”,strlen(a));
return 0;
}
72.write a c program to enter a string “itamati” and check weather
the string is pallendrum or not.
Answer.#include<stdio.h>
#include<string.h>
int main()
char [25],[b[25],int c;
printf(“enter any string”);
gets(a);
strcpy(b,a);
strrev(b);
c=strcmp(a,b);
if(c==0)
printf(“pallendrum string”);
else
printf(“not pallendrum”);
}
return 0;
73.write a cprogram to enter 7 elements in array and display them.
Answer. #include<stdio.h>
int main()
int x[7],i;
printf(“enter the elements of array”);
for(i=0;i<=6;i++)
scanf(“%d”,&x[i]);
printf(“elements of the array are”);
for(i=0;i<=6;i++)
printf(“%d”,&x[i]);
return 0;
}
74.write a c program to enter 5 elements in an array and findout their
sum.
Answer.#include<stdio.h>
Int main()
{
int a[5],i,j=0;
printf(“enter the elements of the array”);
for(i=0;i<=4;i++)
scanf(“%d”,&a[i]);
j=j+a[i];
printf(“sum is=%d”,j);
return 0;
75.write a cprogram to display 2D array.
Answer. #include<stdio.h>
int main()
int a[2][2],i,j;
printf("enter the elements of array");
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
scanf("%d",&a[i][j]);
printf("elements of the array are");
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
printf("%d",a[i][j]);
printf("\n");
return 0;
76.write c program to enter 6 elements in 2d array find the sum/.
Answer. #include<stdio.h>
int main()
int a[3][2],i,j,s=0;
printf("enter the elements of array");
for(i=0;i<=2;i++)
for(j=0;j<=1;j++)
scanf("%d",&a[i][j]);
printf("elements of the array are");
for(i=0;i<=2;i++)
for(j=0;j<=1;j++)
printf("%d",a[i] [j]);
s=s+a[i][j];
}
printf("\n");
printf("sum is =%d",s);
return 0;
77.write a c program to enter two 2*2 matrix and findout their
resultant matrix.
Answer. #include<stdio.h>
int main()
int a[2][2],b[2][2],c[2][2],i,j;
printf("enter the elements of 1st array");
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
scanf("%d",&a[i][j]);
printf("elements of the 2nd array are");
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
scanf("%d",&b[I] [j]);
printf("the resultant matrix is");
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
C [i] [j]=a [i] [j]+b [I ][j];
printf("%d",c [I] [j]);
return 0;
78.write a cprogram to enter 10 elements in array and search an
elements from them.E
Answer. #include<stdio.h>
int main()
int a[10],i,num;
printf("enter the elements of array");
for(i=0;i<=9;i++)
scanf("%d",&a[i]);
printf("enter elements to search");
scanf("%d",num);
for(i=0;i<=9;i++)
if(a[i]==num)
printf("elment found")
else
printf("not found");
}
return 0;
79.write a c program to enter your rollno,age&address.
Answer. #include<stdio.h>
#include<string.h>
int main()
int a;
int b;
char c[25];
}p;
printf(“enter the your”);
scanf(“%d”,&p.a);
printf(“enter your age”);
scanf(“%d”,&p.b);
printf(“enter your address”);
gets(p.c);
printf(“%d”,p.a);
printf(“%d”,p.b);
printf(“%s”,p.c);
return 0;
80.write a c program to display multiplication table.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int a,b,i,j;
clrscr();
printf(“enter any no”);
scanf(“%d”,&a);
for(j=1;j<=10;j++)
printf(“%d”,i*j);
printf(”\n”);
for(i=1;i<=10;i++)
{
printf(“%d”,j);
printf(“\n”);
for(j=1;j<=10;j++)
printf(%d“,i);
printf(“\n”);
getch();
81.write a c program to enter ur name and reverse it.
Answer.#include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
Char b[25];
clrscr();
printf(“enter ur name”);
gets(a);
printf(“%s”,strrev(a));
getch();
82.write a c program to enter your first name and last name and
concat them.
Answer. #include<stdio.h>
#include<string.h>
#include<conio.h>
void main()
char a[25],b[25];
printf(“enter ur first name”);
gets(a);
printf(“enter ur last name”);
gets(b);
strcat(a,b);
puts(a);
getch();
83.write a c program to display the output black board.
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a[25]=”black”;char b[25]=”board”;
clrscr();
strcat(a,b);
puts(a);
getch();
84.write a c program to enter ur state name and find its length.
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a[25];
clrscr();
printf(“enter ur state name”);
gets(a0;
printf(“%d”,strlen(a));
getch();
85.write a c program to display use of strcpy.
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a[25],b[25];
clrscr();
printf(“enter 1st string”);
gets(a);
strcpy(b,a);
printf(“%s”,b);
getch();
86.write a c program to enter 2 fruit name and check their equality.
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
char a[25],b[25],c;
clrscr();
printf(“enter 1st fruit name”);
gets(a0;
printf(“enter 2nd fruit name”);
gets(b);
c=strcmp(a,b);
If(c==0)
printf(“both are equal”);
else
printf(“not equal”);
getch();
87.write a cprogram to display use of strupr().
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a[25],
clrscr();
printf(“enter ur name in small”);
gets(a);
Printf(“%s”,strupr(a));
getch();
88.write a cprogram to display use of strlwr().
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a[25],
clrscr();
printf(“enter ur country name in big”);
gets(a);
printf(“%s”,strlwr(a));
getch();
89.write a c program to demonstate the use of getchar & putchar.
Answer. #include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
char a;
clrscr();
a=getchar();
putchar(a);
getch();
90.write a c program to demonstate the use of multidimensional
array.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int x[2][2][3],I,j,k;
clrscr();
printf(“enter the elements of the array”);
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
for(k=0;k<=2;k++)
scanf(“%d”,&x[i][j][k]);
printf(“elements if array are”);
for(i=0;i<=1;i++)
for(j=0;j<=1;j++)
{
for(k=0;k<=1;k++)
printf(“%d”,x[i][j][k]);
getch();
92.write a c program to enter 3 iteams name and display that cost
using function.
Answer. #include<stdio.h>
#include<conio.h>
void main()
clrscr();
pen();
book();
pencil();
getch();
}
pen()
printf(“its cost is 10 rupees”);
book()
printf(“its cost is 50 rupees”);
pencil()
printf(“its cost is 5 rupees”);
93.write a c program to display use of with without function.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int a=2;b=3;
clrscr();
pass(a,b);
getch();
pass(a,b)
printf(“%d%d”,a,b);
94.write a c program to display use of with with function.
Answer . #include<stdio.h>
#include<conio.h>
void main()
int x;
clrscr();
x=uniitech(20,30);
printf(“%d”,x);
getch();
uniitech(20,30)
{
return a*b;
95.write a c program to diplay without with function.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int p;
clrscr();
p=call();
printf(“%d”,p);
getch();
call()
return 10;
96.write a c program to diplay without without function.
Answer. #include<stdio.h>
#include<conio.h>
void main()
keyboard();
keyboard()
printf(“its an i/p device”);
getch();
97.write a c program to diplay your name infinite time using
recursion.
Answer. #include<stdio.h>
#include<conio.h>
void main()
clrscr();
printf(“AKASH”);
main();
}
98.write a c program to display the use of pointer.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int a,*b;
clrscr();
printf(“enter a no”);
scanf(“%d”,&a);
b=&a;
printf(“address of a is=%d”,b);
printf(“value of a is=%d”,*b);
getch();
99.write a c program to display use of void pointer.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int x=5;
void *y;
y=&x;
printf(“%d”,*y);
getch();
100.write a c program to display the use of null pointer.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int *y=NULL;
clrscr();
printf(“%d”,*y);
getch();
101.write a c program to display use of wild pointer.
Answer. #include<stdio.h>
#include<conio.h>
void main()
{
int *y;
clrscr();
printf(“%d”,*y);
getch();
102.write a c program to diplay use of dangling pointer.
Answer. #include<stdio.h>
#include<conio.h>
void main()
int *ptr=(int a)malloc(sizeof (int));
clrscr();
free (ptr);
printf(“%d”,*ptr);
ptr=NULL;
103.write a c program to display use of near pointer.
Answer. #include<stdio.h>
#inclde<conio.h>
void main()
{
int x=25;
int near *ptr;
ptr=&x;
printf(“%d”,sizeof(ptr));
getch();
104.write a c program to display the use of near pointer.
Answer. #inclue<stdio.h>
#include<conio.h.
void main()
int x=25;
int far*ptr;
ptr=&x;
printf(“%d”,sizeof(ptr));
getch();