You are on page 1of 55

# 1

-: C - PROGRAMS :1. Program to print text
2.Program To Read Two Numbers And Print The Sum Of Given Two Numbers.
3.Program To Accept Student Roll No, Marks in 3 Subjects and Calculate Total, Average
and Print it.
4.Program To Read Three Numbers And Print The Biggest Of Given Three Numbers
5.Program To Read A Number And Find Whether The Given Number Is Even Or Odd.
6.Program to accept a year and check whether the given year IS leap year or not.
7.Individual Digits
8. Program to accept a three digit number and print the sum of individual digits.
9. Program to accept a number and check the given number is Armstrong or not.
10. Program to print ODD numbers from 1 to 10
11. Program to print natural numbers from 1 to 10 in Reverse
12. Program to print sum of the natural numbers from 1 to 10.
13. Program to accept a number and print mathematical table of the given no.
14. Program to print 1 to 10 mathematical tables .
15. Program to print fibonacci series .
16. Program to print numeric pyramid
17. Program to print numerical pyramid.
18. Program to print numerical diamond.
19. Program to print character pyramid.
20. Program to print character diamond.
21. Program to find biggest of two no by using ternary numbers
22. Program to find biggest of four no by using ternary numbers
23. Program to print smallest of four no by using ternary operators
24. Program to accept a year and check the given year is leap or not by using ternary
25. Program to accept a character in the uppercase and print in lower case.
26. Program to accept a character in any case and print in another case.
27. Program to natural number from 1 to 10 by using while loop.
28. Program to accept a string and print it by using the while loop.
29. Program to accept a string in upper case and print it by lower case.

2
30. Program to accept a string in any case and print it by another case .
31. Program to accept a string print each word in new line.
32. Program to accept a string and count no of capital letters, no. of small letters and no.
of special characters
33. Program to accept any single digit number and print it in words .
34. Program to print prime numbers between 1 to 100
35. Program to accept two numbers and print sum of two numbers by using functions
36. Program to accept a number and find factorial of given number
37. Program to accept a number and check the given number Armstrong or not
38. Program to accept a number and print the sum of given and Reverse number
39. Program to accept 10 numbers and print first five numbers in original order and print
last five numbers in reverse order.
40. Program to accept a string and print the reverse of the given string by using for loop.
41. Program to accept a string and check the given string is palindrome or not .
42.Program to accept values into 3 dimensional array and print .
43. Program to print upper triangle .
44. Program to accept two 3 dimensional array and store addition of those into arrays into
the third array .
45. Program to accept a string and find the length of the given string by using functions
46. Program to count the number of words, characters, alphabets, vowels, consonants and
digit in a line of text.
47. Program to accept two string and compare the strings are equal or not
48. Program to sort the entered numbers using bubble sort.
49. Program to read date,month, year and print the next day‟s date,month,year.
50. Program to interchange two values using pointers.
51. Program to print “PASCAL TRIANGLE”.
52. Program to check whether a given number is perfect or not.
53. Program to check whether a given number is prime number.
54. Program to read „n‟ number and print them in matrix terms in all orders.
55. Program to search an element using binary search
56. Program to accept two numbers and print the sum of given two numbers by using
pointers

3
57. Programs to multiply two Matrices
58. Program to print prime number between 1-100
59. Program to accept a string and find the length of the string
60. Program to fibanocci of matrix
61. Program a structure which reads „n‟ students information (name,3 subjects marks)
and calculate total marks, result print them in a particular format.
62. Program to find whether a square matrix is a) symmetric b) skew symmetric c) none
of two.
63. Program to find area of a triangle when there sides are given.
64. Program to print Armstrong number between 1-500.
65. Program to check whether a given number is Armstrong or not.
66. Program to print the floyd‟s triangle.
67. Program to read data in 3 structures and print
68. Program to print a diagonal matrix.
69. Program to copy contents of one file into another.
70. Program to create a file of number and copy odd number into second file and even
number into third file.
71. Program a structure which stores information about hotels which stores information
72. Program which does the below process after reading on odd no of integer.
73. Program to sort the entered elements using selection sort technique.
74. Program to find whether a number is divisible by „11‟ or not without actual division.
75. Program to find maximum and minimum of entered ‟n‟ number using arrays.
76. Program to print the following series until there sum exceeds 2.6 term value exceeds
1.5
x+x2/2!+x3/3!+------------.
77. Program to print a frequency distribution table for a class of 20-students in the
following format.
The marks range form 1-25.
78. Program to accept values into an array and print array in reverse and original format
by using three different functions.

4
79. Program to accept values into single dimensional array and print the array in reverse
by using pointers.
80. Program to read a string and print the number of characters in each word of the string.
81. Program to accept two strings and compare those two strings
82. Program to accept a string using pointers and functions.
83.Program to read a string and print the first two characters of each word in the string.
84.Program to accept two numbers and print the sum of given two numbers by using
pointers
85.Program to accept a string and print reverse of the given string by using functions.
86. Program to accept two 3 dimensional array and store subtraction of those two arrays
into third array..
87.Program to accept a single dimensional array and print them by using pointers
88.Program to accept two strings and biggest among them
89.Program to print 4 dimentional matrix with constant number.
90.Prongram to accept a string and print each word in reverse
91. Program to accept elements into single dimensional array and print the array in
ascending order by using three different arrays.
92.Program to accept data and store the given data into file print the data.
93. Program to accept data in lower case and store the given data into file into upper case
and print the data.
94.Program to copy contents of one file into another.
95. Program to create a file of numbers and copy odd number into second file and even
number into third file
96.Program to accept a string in lower case and print first character of each word in upper
case.
97.Program to accept two numbers and interchange two values using functions.
98.Program for example of static variable.
99.Program to accept a string and print by trailing spaces.
100. Program to print anti diagonal.

5
1. Program to print text
# include <stdio.h>
# include <conio.h>
main()
{
clrscr();
printf(“HELLO! WELCOME TO RAJ KUMAR”);
printf(“Warangal phone : 9247850513”);
getch();
}

2. Program To Read Two Numbers And Print The Sum Of Given Two Numbers.
# include <stdio.h>
# include <conio.h>
main()
{
int a,b, sum;
clrscr ();
printf (“ENTER VALUE FOR A : “);
scanf (“%d”,&a);
printf(“ENTER VALUE FOR B :”);
scanf(“%d”,&b);
sum=a+b;
printf(“Sum Of Given Two Numbers are %d”, sum);
getch();
}

3. Program To Accept Student Roll No, Marks in 3 Subjects and Calculate Total, Average
and Print it.
# include <stdio.h>
# include <conio.h>
main()
{
int r,b,c,d, tot, avg;
clrscr();
printf (“ENTER STUDENT RNO : “);
scanf (“%d”,&r);
printf(“ENTER FIRST SUBJECT MARKS :”);
scanf(“%d”,&b);
printf(“ENTER SECOND SUBJECT MARKS:”);
scanf(“%d”,&c);
printf(“ENTER THIRD SUBJECT MARKS :”);
scanf(“%d”,&d);
tot=b+c+d;
avg=tot/3;
printf(“\n\t STUDENT RNO
: %d “,r);

d). if(r= = 0) printf(“the above given number is even number”).h> # include <conio. : %d”. Program To Read A Number And Find Whether The Given Number Is Even Or Odd. r=n%2.&b). tot). &n).h> # include <conio. if(b>big) big=b.c. printf(“ENTER A NUMBER :”). :%d “. :%d “.&a).big) getch( ).c).big=0. } 4. :%d “. Program To Read Three Numbers And Print The Biggest Of Given Three Numbers # include <stdio. printf (“BIGGEST OF ABOVE GIVEN THREE NUMBER IS %d”. # include <stdio. printf(“ENTER VALUE FOR B:”).b. : %d”. else printf(“the above given number is odd number”).h> main( ) { int a. scanf(“%d”. getch().&c). if (c>big) big=c. printf(“ENTER VALUE FOR A:”). avg).r. scanf(“%d”.h> main() { int n. scanf(“%d”. scanf(“%d”. print(“ENTER VALUE FOR C:”).b). } . } 5.6 printf(“\n\t FIRST SUBJECT MARKS printf(“\n\t SECOND SUBJECT MARKS printf(“\n\t THIRD SUBJECT MARKS printf(“\n\t TOTAL MARKS printf(“\n\t AVERAGE MARKS getch(). clrscr(). clrscr( ). if (a>big) big=a .

h> # include <conio. scanf (“%d”. a=n/100. printf (“ Enter a Three Digit Number:“). printf(“enter a year:”).b.d. scanf(“%d”. # include <stdio. getch( ). d). getch( ). c=n%10. } . Program to accept a three digit number and print the sum of individual digits. clrscr( ). clrscr( ). c=a%10.n. printf(“the above given year IS a leap year”).&n). else printf(“the above given year IS not a leap year”). b=( (n%100)/10).h> main( ) { int y. sum=a+b+c. if(y%4==0& &y%100!=0|| y%400==0).&y). # include <stdio.h> main( ) { int a. Sum). printf ( “ Enter a two digit number :”).7 6. printf (“ Sum of Individual Digits of Given Numbers is %d”. d=b+c.h> # include <conio. b=a/10.c. printf (“sum of individual digits of given numbers id %”. Individual Digits # include <stdio. clrscr( ). } 7.h> main( ) { int a. sum. scanf (“ %d”.b. } 8.c. Program to accept a year and check whether the given year IS leap year or not.h> # include <conio. &a). getch().

i). getch( ). Program to print natural numbers from 1 to 10 in Reverse # include <stdio. d=a*a*a*+b*b*b +c*c*c. getch( ).h> main( ) { int i. if (n= =d) printf (“The Given Number is Armstrong number”). } . for (i=10. b=((n/10)%10). } 10. printf (“ Enter a Three Digit Number: “). clrscr( ). i--) printf(“%d\n”. clrscr( ). i<=10. a. b. scanf (“%d”. c=n%10. getch( ).h> # include <conio.h> main( ) { int i. } 11. d. else printf (“The Given Number is Not Armstrong number”). # include <stdio.8 9. a=n/100.h> # include <conio. i+=2) printf(“%d\n”. for (i=1. clrscr( ).h> # include <conio. Program to accept a number and check the given number is Armstrong or not.i). &n). c. i>=1. Program to print ODD numbers from 1 to 10 # include <stdio.h> main( ) { int n.

# include <stdio. getch( ).t. clrscr( ).i*j). Program to accept a number and print mathematical table of the given no.9 12. i<=10. getch( ).h> main( ) { int i. # include <stdio. clrscr( ).&t). clrscr( ).h> # include <conio.h> # include <conio. for (i=1. # include <stdio.h> # include <conio.sum).i. i++) for(j=1. for (i=1.i.j++) printf(“\n%d*%d=%d”. } 14. Program to print sum of the natural numbers from 1 to 10. printf(“which table u want:”). i<=10.h> # include <conio.i*t).t.i.sum=0. } 13. printf(“sum of natural numbers from 1 to 10 is %d\n”. getch( ). # include <stdio. scanf(“%d”. i++) printf(“\n%d*%d=%d”.j.j<=10. for (i=1. Program to print 1 to 10 mathematical tables . i++) sum=sum+i.h> main( ) { .j.h> main( ) { int n. } 15.h> main( ) { int i. i<=10. Program to print fibonacci series .

b).l<=k.k=40.i<=9.i<=5. printf(“\n%d”. } getch( ).c).j .l++) printf(“ “ ). } getch(). clrscr( ). a=b.h> # include <conio. for(i=1. } getch( ).a). Program to print numerical pyramid. for(i=1.h> main() { int i. printf(“\n”). } . for (i=1. # include <stdio.j++) printf(“%d”. printf(“\n%d”.i+=2) { for(l=1.c=0. b=c. Program to print numeric pyramid # include <stdio.h> main( ) { int i.j++).j<=i. for(j=1. i<=10. printf(“\n”).i.j).10 int a=0.j). clrscr( ).l. i++) { c=a+b. clrscr( ). printf(“%d”. } 16.j<=i.h> # include <conio. printf(“%d”.i++) { for(j=1. k=k-2. } 17.b=1.j.

i+=2) { for(l=1.j++) printf(“%c”.n-=2) { for(i=1. } getch( ).i++) { for(j=65.j++) printf(“\n”).h> # include <conio.i<=9.i<=70.j.i<=k.k=40. Program to print character pyramid. } 20.s<n.h> main( ) { char i. Program to print numerical diamond.s).j).n>=1. Program to print character diamond. for(i=65.h> # include <conio. k=k+2. # include <stdio. for(s=1.i++) printf(“ “). k=k-2.l. printf(“\n”).j.j<=i. } k=k+4.s++) printf(“%d”. for(i=1. printf(“\n”).l<=k.11 18.j<=i.l++) printf(“ “). # include <stdio. clrscr().n. } 19. # include <stdio.s. for(j=1. } getch( ).h> . clrscr( ).h> main( ) { int i. for(n=7.

printf(“enter value a”). printf(“enter the value of b”).n>=65.h> main( ) { .r.j). for(j=65.r<=n. clrscr( ).h> # include <conio. printf(“biggest of the given numbers IS %d”. Program to find biggest of four no by using ternary numbers # include <stdio. for(i=65. for(r=65. } sp=sp+4. big=(a>b)?a:b.n-=2) { for(s=1.s++) printf(“ “).s++) printf(“ “).j++) printf(“%c”. } 21.r). } 22.&b). printf(“\n”). for(n=73.h> main( ) { char i.h> main( ) { int a.12 # include <conio. getch(). Program to find biggest of two no by using ternary numbers # include <stdio.b.big.s<=sp.r++) printf(“%c”.j<i. sp=sp+2.big). sp=sp-2. } getch( ).n. int s.i+=2) { for(s=1. scanf(“%d”.i<=75.&a).sp=40. clrscr( ). scanf(“%d”.h> # include <conio.j.s<=sp.

if(leap= =1) printf(“ the given year is leap year”).big). scanf(“%d”. scanf(“%d”.13 int a. getch(). scanf(“%d”.h> main( ) { int y. Program to print smallest of four no by using ternary operators # include <stdio.small).big. clrscr( ).&b).c. printf(“enter the value of c”). printf(“enter the value of b”). scanf(“%d”. big=(a>b)?(a>c)?(a>d)?a:d:(c>d)?c:d:(b>c)?(b>d)?b:d:(c>d)?c:d.leap.&a). leap=(y%400= =0)?:(y%100!=0)?(y%4= =0)?1:0:0.d. scanf(“%d”. printf(“biggest of the given 4 numbers IS %d”.&d).&y).&d). printf(“biggest of the given 4 numbers IS %d”. else . printf(“enter the value of c”).&c). scanf(“%d”. printf(“enter value a”). printf(“enter value a”). } 23.b. clrscr( ). scanf(“%d”. printf(“enter the value of b”).h> # include <conio. printf(“enter any yr”).&b).h> main( ) { int a.&c).c. scanf(“%d”. Program to accept a year and check the given year is leap or not by using ternary # include <stdio.d. getch(). scanf(“%d”. } 24. printf(“enter the value of d”).small. printf(“enter the value of d”).h> # include <conio.&a). small=(a<b)?(a<c)?(a<d)?a:d:(c<d)?c:d:(b<c)?(b<d)?b:d:(c<d)?c:d. clrscr( ).b.

h> main( ) { char ch. printf(“enter a char in anycase”).14 printf(“given year is not leap year). Program to natural number from 1 to 10 by using while loop.h> main( ) { char ch. getch( ). } 25. getch().h> # include <conio. ch=getchar().h> main( ) { int a=0. # include <stdio.c1. else if(ch>=97 && ch<=122) c1=ch-32. ch=getchar().c1. putchar(c1). getch(). # include <stdio.h> # include <conio. putchar(c1). # include <stdio.h> # include <conio. clrscr(). printf(“enter a cha in uppercase”). clrscr( ). printf(“the given char in lowercasecase is”). clrscr( ). . Program to accept a character in any case and print in another case. if(ch>=65 && ch<=90) c1=ch+32. Program to accept a character in the uppercase and print in lower case. printf(“the given char in anothercase IS”). c1=ch+32. } 26. } 27.

h> main( ) { char ch. # include <stdio. clrscr(). Program to accept a string in upper case and print it by lower case.h> # include <conio. } printf(“ is in lower case”). while(( ch=getchar( ))!=‟\n‟) { c=ch+32.c. } 29. } getch(). printf(“enter a string in upper case:”). putchar(c). . # include <stdio.15 while( a<10) { a=a+1. clrscr(). getch( ). while(( ch=getchar( ))!=‟\n‟) putchar(ch). getch(). } 28. clrscr( ).h> main( ) { char ch. printf(“%d\n”. # include <stdio.h> main( ) { char ch. Program to accept a string and print it by using the while loop.h> # include <conio. printf(“enter a string”).a). } 30. Program to accept a string in any case and print it by another case .h> # include <conio.

} 31. while(( ch=getchar( ))!=‟\n‟) { if(ch>=‟A‟&& ch>=‟Z‟) c=c+1. printf(“enter a string :”).s1=0. # include <stdio. Program to accept a string and count no of capital letters. of small letters and no. if(ch= =‟ „) printf(“\n”).h> main( ) { char ch. } getch( ). } printf(“ is the string”). while(( ch=getchar( ))!=‟\n‟) { if(ch>=‟A‟ && ch<=‟Z‟) putchar(ch+32). of special characters # include <stdio.16 printf(“enter a string :”). Program to accept a string print each word in new line. else putchar(ch). else if(ch>=‟a‟&& ch>=‟z‟) . while(( ch=getchar( ))!=‟\n‟) { putchar(ch). clrscr( ).h> # include <conio.h> # include <conio. else if(ch>=‟a‟ && ch<=‟z‟) putchar(ch-32). getch( ). int c=0.h> main( ) { char ch. } 32. printf(“enter a string :”). no.s=0. clrscr( ).

case 6: printf(“SIX”). break.&n). case 7: printf(“SEVEN”).h> main( ) { int n. case 5: printf(“FIVE”). printf(“ no of smal1 letters are %d”. } getch( ). break.s1). break. printf(“ no of special characters are %d”.s). # include <stdio. printf(“enter a number :”).h> # include <conio. } 33. clrscr( ). break. scanf(“%d “. case 9: printf(“NINE”). break. Program to accept any single digit number and print it in words . switch(n) { case 0: printf(“ZERO”).c). default: printf(“please enter the number between 0 and 9”). case 1: printf(“ONE”). Program to print prime numbers between 1 to 100 . case 4: printf(“FOUR”). break. break. } printf(“ no of capital letters are %d”. break. case 2: printf(“TWO”). break.17 s=s+1. break. case 3: printf(“THREE”). } 34. else s1=s1+1. getch( ). case 8: printf(“EIGHT”).

n++) if(i%n= =0) { check=0. for(n=2. getch( ). clrscr().h> .&a). return z. z=x+y.h> # include <conio. printf(“enter the value for b:”) scanf(“%d”.i). printf(“enter the value for a:”) scanf(“%d”. } if(check= =1) printf(“\n %d is a prime”.n<=i/2.i++) { check=1.b.h> main( ) { int a. for(i=1. i.i).h> main( ) { int n.c). Program to accept a number and find factorial of given number # include <stdio. } getch( ).&b). check. } 35.18 # include <stdio. } int add(int x. c=add(a.c. break. printf(“sum of two numbers is %d”.b). Program to accept two numbers and print sum of two numbers by using functions # include <stdio. int y) { int z. else printf(“\n %d is not a prime”. clrscr(). } 36.i<=100.h> # include <conio.

} int Armstrong (int n) { int a. } 37.&n).h> # include <conio. Program to accept a number and check the given number Armstrong or not # include <stdio. b=((n/10)%10).n). clrscr( ). return fa.i>=1. if(arm= =n) printf(“%d is Armstrong number”. else printf(“%d not a Armstrong number”. getch().&n). fa=1.i--) fa=fa*i.d.b. a=n/100.f. printf(“enter any 3 digit number:”) scanf(“%d”. getch( ).f). } int fact(int n) { int i.n). clrscr().arm.c.19 # include <conio. f= fact(n). c=n%10. printf(“factorial value is %d”. d=a*a*a+b*b*b+c*c*c. printf(“enter a number:”) scanf(“%d”.h> main( ) { int n. } 38. arm= armstrong(n).h> main( ) { int n. for(i=n. return d. Program to accept a number and print the sum of given and Reverse number .

a).rev=0.&a[i]). getch( ).h> main( ) { int i.h> main( ) { int a. } int add(int n.a).h> # include <conio. getch( ). while(n>0) { r=n%10.&n).i<=4. printf(“REVERSE OF A GIVEN NUMBER IS %d”. for(i=0.a[i]).i>=5. } .i.a[i]). printf(“\n sum of a given and reverse number is %d”.20 # include <stdio. # include <stdio.n. n=n/10. b=add(n. } int rev( int n) { int r.h> # include <conio. rev=rev*10+r. } for(i=0.b. scanf(“%d”. a=rev(n). Program to accept 10 numbers and print first five numbers in original order and print last five numbers in reverse order.i++) { printf(“enter value for a[%d]”. int a) { return n+a. } 39.s.i--) printf(“\nA[%d]=%d”.i<10. } return rev. for(i=9.a[10]. clrscr( ). printf(“enter a number:”) scanf(“%d”.i).b).i.i++) printf(“\nA[%d]=%d”.

21 40. } if(check= =1) printf(“the given string is palindrome “).j--) putchar(name[j]).Program to accept values into 3 dimensional array and print .j>=0. printf(“is the reverse of given string”).i<80 && ((word [i]= getchar())!=‟\n‟).h> main( ) { int i.h> main( ) { int i. if(name[i]= =‟\n‟) name[i]=‟\0‟.h> # include <conio. char word[80]. Program to accept a string and print the reverse of the given string by using for loop. Program to accept a string and check the given string is palindrome or not . } 42. c=lim/2. } 41. getch( ). getch( ). printf(“ enter a string”).i++). for(i=0.h> # include <conio. for(j=i.i<80 && ((name [i]= getchar())!=‟\n‟). # include <stdio.h> . # include <stdio.j. clrscr( ). clrscr( ). # include <stdio.i<=0. gets(name).check=1. lim=i-1. break. for(i=0. for(i=0.c. char name[80].i++.i++).lim--) if(word[i]!= word[lim]) { check=0. else printf(“ not palindrome”). printf(“ enter a string”).lim.

i++) { for(j=0. printf(“ enter which no u want”). # include <stdio. } 44. for(i=0.i.i++) for(j=0. scanf(“%d”. for(i=0.j++) { printf(“ enter the value for a[%d][%d] :”.i<=2.a[i][j]).h> # include <conio. scanf(“%d”. printf(„\n”).i++) for(j=0.h> # include <conio. } for(i=0.j<=2.a[i][j]).&a[i][j]).j<4. } 43.j++) { printf(“ %d:”.j++) printf(“ %d:”.j.j). Program to accept two 3 dimensional array and store addition of those into arrays into the third array .j++) if(i<j) a[i][j]=c. # include <stdio.h> main( ) { int a[3][3]. for(i=0. Program to print upper triangle .&c). } getch( ).j.c.22 # include <conio.i.i.j<4.i++) for(j=0. else a[i][j]=0. clrscr( ). printf(„\n”).j<=2. } getch( ).h> main( ) .i<4.h> main( ) { int a[4][4].i<=2.i<4. clrscr( ).

scanf(“%d%d”. } printf(“\n”).i++) { for(j=0.h> # include <conio.j<3.i.h> int getline(char str[]).j++) { printf(“enter the two values for a[%d][%d] & b[%d][%d]”.length). vowels.c[i][j]). clrscr( ). printf(“%d”.h> #include<conio. } 45. } 46.i<3.&b[i][j]).j. printf(“length of the given string is %d”. printf(“ enter a string”). i. consonants and digit in a line of text.i<3. alphabets. Program to accept a string and find the length of the given string by using functions # include <stdio.i<80&&((str[i]=getchar( ))!=‟\n‟). length=getline(str). Program to count the number of words.j++) { c[i][j]=a[i][j]+b[i][j].b[3][3].c[3][3]. #include<stdio. clrscr( ). } for(i=0.j<3. getch ( ). if(str[i]= =‟\n‟) str[i]=‟\0‟. return i. characters. } int getline(char str[]) { int i.j).&a[i][j]. for(i=0.23 { int a[3][3].h> . } getch( ).i++) for(j=0. for(i=0. int length.j. main( ) { char str[80]. i++).i.

for(i=0. getch( ).nob=0.l). char str2[] ). printf(total no of characters(without blanks)%d”. printf(total no of characters %d”. printf(“enter 2 lines of text”). main( ) . noc=noa-nov.i<1. } if(isalpha(s[i])) noa++.h> int getline (char line[ ].l. } 47.24 main( ) { int noa=0. printf(total no of words %d”.noa).I.noc).nov). } noch=l-nob.nov=0. printf(total no of alphabets %d”.i++) { switch(s[i]) { case „a‟: case „e‟: case „i‟: case „o‟: case „u‟: case „A‟: case „E‟: case „I‟: case „O‟: case „U‟: nov++.nod). int lim ). printf(total no of digits %d”. gets(s).noch=0. printf(total no of vowels %d”. clrscr( ).h> # include <conio. int strc(char str1[ ].now). if(noa[i]==‟ „) && (noa[i+1]!=‟ „) now++.s[100]. Program to accept two string and compare the strings are equal or not # include <stdio. break. l=strlen(s). char ch.noc=0. if(isdigit(s[i])) nod++.noch). printf(total no of characters(including blanks)%d”.now=0.

&n).t. } 48. for(i=1. scanf(“%d”. int comp.h> # include <conio.i<n.i++) scanf(“%d”.j<n. clrscr( ).i.n.h> main( ) { int a[100]. getline(str2. if(comp>0) printf(“first string is bigger”). printf(“enter first string:”). return str1[i]-str2[i]. for(i=1. clrscr( ).i++) if(str1[i]!=str2[i]) return str1[i]-str2[i]. if(str[i]=‟\0‟) return i.j.80).char str2[]) { int i.j++) if(a[i]>a[j]) { t=a[i] .&a[i]).str2[80]. getline(str1. } int strc(char str1[].str1[i]. int lin) { int i.i++) for(j=i+1.80). comp=strc(str1. # include <stdio. else if(comp==0) printf(“both the strings are equal”). for(i=0. } int getline(char str[].i<=n.25 { char str1[80]. Program to sort the entered numbers using bubble sort.str2). printf(“enter second string:”).i++). for(i=0. printf(“enter the array size”). getch( ).i<lin&&((str[i]=getchar())!=‟\n‟).

30.30.30.nd. getch( ).31.month. } printf(“Given date is %d:%d:%d\n”.ny).ny. for(i=1.i++) print(“%d”.&y).y.m.h> # include <conio.&d.&m. nm++. if(m==2) { if(y%100==0) { if(y%400==0) ndays=29.y). scanf(“%d%d%d”. int d.m.31.nm.ndays. } 49.d.28. a[j]=t. nm=m.31}. ny=y. Program to read date.a[i]). getch( ). } printf(“the sorted elements are “).26 a[i]=a[j]. } else if(y%4==0) ndays=29.31. } nd=nd+1. printf(“enter the date.nd.31. ny++.year.year”).nm.h> main( ) { int month[12]={31. } . clrscr( ). # include <stdio. } if(nm>12) { nm=1.30.month. ndays=month[m-1].i<=n.31. printf(“next days date is %d:%d:%d”. year and print the next day‟s date. if(nd>ndays) { nd=1.month.

h> #include<conio. Program to interchange two values using pointers. interchange(&a.&b). printf(“\n”). } 51.*x.p<=n.y) int *x. *x=*y. t=*x. clrscr( ).&n). printf(“%2d”.sp. printf(“enter the number of rows”). # include <stdio.sp++) printf(“ “). printf(“%d=x.q. Program to print “PASCAL TRIANGLE”.int *y). } void interchange(x. scanf(“%d%d”. }} getch( ). { int t.q<n.q++) { if((q==q)||(q==0)) num=1. #include<stdio. main( ) { int a.27 50.h> # include <conio. %d=y”.num.&a.b. *y=t.*y. getch( ).p=1.&b).sp<=40-(3*p). printf(“enter values of a and b”). else num=num*((q-q)+1)/q.p++) { for(sp=1. } .num).h> void interchange(int *x.h> main() { int n. scanf(“%d”. for(p=0. clrscr( ). for(q=0.*y).

k.&n). printf(“enter the array size”). else printf(“given number is not prime number”). printf(“enter a number”).h> main( ) { int i. for(i=1. . if(c==2) printf(“given number is a prime number”). Program to read „n‟ number and print them in matrix terms in all orders.28 52.s=0. } 54.p. getch( ).&n).a[20].h> main( ) { int i.n. # include <stdio.c.i<n/2. clrscr( ). # include <stdio.h> main( ) { int i. # include <stdio. scanf(”%d”. scanf(“%d”. clrscr().h> # include <conio.r.i<=n. } 53.n.h> # include <conio. if(s= =n) printf(“the number is perfect no”).&n). else printf(“the number is not perfect “). getch( ).c=0.i++) if(n%i==0) s+=i. Program to check whether a given number is perfect or not. scanf(“%d”. clrscr(). printf(“enter the number”). for(i=0. Program to check whether a given number is prime number.i++) if(n%i==0) c++.h> # include <conio.q.n.

c=0.h> # include <conio.h> main( ) { int a[100].p++) { for(q=1.i<=n.i. else if(a[mid]>x) bot=mid-1.i++) scanf(“%d”.q<=c. scanf(“%d”. mid. for(p=1.&a[i]). } 55. for(i=1. printf(“enter the array size.i<=n. printf(“enter the element to searched”).&a[i]). } if(c==1) . printf(“enter the array elements”). k=1. } i++. scanf(“%d”. Program to search an element using binary search # include <stdio. if(a[mid]<x) top=mid+1. for(i=1.&n). getch( ).&x). bot=n. c=n/i.29 printf(“enter the elements”).n. bot.p<=r.q++) printf(“%d”.c. else c=1. while(i<=n) { if(n%i==0) { r=i.”).i++) scanf(“%d”. while((top <=bot)&&(c==0)) { mid=(top+bot)/2.a[k++]) printf(“\n”). top=1.x. i=1. clrscr(). top.

for(k=1.i++) for(j=1.j++) { c[i][j]=0.&m.c[10]. getch( ).[10].b[10][10].m.j<n. if(n==p) { printf(“enter first matrices elements”). . getch( ). a=10. for(i=1.%d”.k<n. clrscr( ). clrscr( ). else printf(“elements is not in list”).i<m.&n). } 56.j++) scanf(“%d”.&b[i][j]). printf(“enter the size of second matrix”).c. c=*(&a)+*(&b). scanf(“%d%d‟. printf(“%d”.mid).h> main( ) { int a[10][10].h> # include <conio.j.k++) c[i][j]=c[i][j]+a[i][k]*b[k][j].j<q. } 57. scanf(“%d%d‟.i<m.i++) for(j=1.p.h> main( ) { int a.h> # include <conio.c).j++) scanf(“%d”.&p. b. printf(“enter second matrix elements”). b=20.k. for(i=1.i++) for(j=1.&a[i][j]).i<p. Programs to multiply two Matrices # include <stdio.n.30 printf(“elements is at position.q.i.&q). Program to accept two numbers and print the sum of given two numbers by using pointers # include <stdio. printf(“enter the size of first matrices”).j<n. for(i=1.

getch( ).i). } .j<n. } 59. if(c==2) printf(“\n%d”. for(i=0. } 58. printf(“enter a string .i++) if(n%i==0) c++.”).j++) print(“%2d”. Program to accept a string and find the length of the string # include <stdio. for(i=1.i<m. clrscr( ).31 } printf(“the multiplication matrix is”).h> main( ) { int i.n).h> main( ) { char name[80].n++) { c=0.i++). Program to print prime number between 1-100 # include <stdio.h> # include <conio.i<=n. clrscr( ).c. } getch( ).c[i][j]). getch( ).i++) { for(j=1. int i.n. for(n=1. for(i=1.i<80&&((name[i]=getchar( ))!=‟\n‟). } } else printf(“multiplication is not possible”). printf(“\n”). printf(“%d is the size of string”.n<=100.h> # include <conio.

m. } 61.&a[i][j]). clrscr( ). printf(”enter name\n”). Program a structure which reads „n‟ students information (name.i). printf(“enter no of students \n”). }stud[10].&stud[i]. getch( ).m3.h> # include <math.m1+stud[i].32 60. printf(“enter the element of matrix”). clrscr( ).m3>35)) . scanf(“%d%d%d”.norm). # include <stdio.h> main( ) { int a[10][10]. stud[i].&n). tot. printf(“enter marks of 3 subjects \n”). scanf(“%d%d”.i++) { printf(”enter %d student deatails \n”.h> # include <conio.tot=stud[i].i<=m.m2+stud[i].h> main( ) { struct student { char name[20]. scanf(“%s”. &stud[i].j<=n.name).n. for(i=0. sum=sum+(a[i][j]*a[i][j]) } norm=sqrt(sum). printf(„enter the matrix size”).m2.&stud[i]. printf(“norm=%f”.m1. char result[10].&m.i<n.3 subjects marks) and calculate total marks.n sum=0. int m1.m3. scanf(“%d”.i++) for(j=1.m1>35)&&(stud[i]. int i.m3).j++) { scanf(“%d”.&n).h> # include <conio. result print them in a particular format. for(i=1. float norm.i.j.m2.m2>35)&&(stud[i]. stud[i]. if((stud[i]. Program to fibanocci of matrix # include <stdio.

for(i=0.j++) scanf(“%d”.h> main( ) { int a[10][10].result. Program to find whether a square matrix is a) symmetric b) skew symmetric c) none of two. else strtcpy(stud[i]. else if(a[i][j]==a[j][i]) c1=1.i<=m.j++) { if(a[i][j]==a[j][i]) c=1. stud[i].stud[i]. for(i=1.i<=m. else printf(“none of two”). # include <stdio.i<=m.i++) for(j=1.result. printf(“enter the elements”).m.i++) { printf(“%s %d %s \n”.a[i][j]).n. } getch( ).h> # include <conio. printf(“name total result \n”).”pass”). scanf(“%d”. } clrscr( ).j++) printf(“%4d”. for(i=1. printf(“enter the array size”). clrscr( ).j<=n.result). else if(c1==0) printf(“the matrix is skew symmetric”).i. } if(c==0) printf(“the given matrix is symmetric”).name.33 strcpy(stud[i].&n).j.j<=n. printf(“\n”).”fail”). .i++) for(j=1. } printf(“the given matrix is \n”).stud[i].tot.&a[i][j]).i++) { for(j=1. } 62.i<n.c=0. for(i=1.c1=0.j<=n.

b. s=s+(r*r*r).h> # include <conio. clrscr( ). } if(i==s) printf(“\n%d”.&a. getch( ).i++) { n=i.34 } getch( ).s.s). else s=(a+b+c)/2. scanf(“%d%d%d”. } getch().2f”. Program to check whether a given number is Armstrong or not. Program to print Armstrong number between 1-500. # include <stdio. } 64.area).h> main( ) { int i.r. if((a+b)<c||(b+c)<a||(a+c)<b) printf(“finding area is not possible”). } 65.&c). s=0. . clrscr( ). } 63.i<=500.n. #include<stdio.&b. printf(“area=%. float s. n=n/10. area. printf(“enter there sides of the triangle”). area=sqrt(s*(s-a)*(s-b)*(s-c)).c.h> main( ) { int a.h> #include <conio. Program to find area of a triangle when there sides are given. while(n>0) { r=n%10. for(i=1.

j++) printf(“%3d”.k).h> main( ) { int i.s.h> main( ) { int i.h> # include <conio. s=0.k++). } 66. printf(“\n”). Program to print the floyd‟s triangle.r k=1. clrscr( ). } if(k==s) printf(“given number is Armstrong %d”. } 67. printf(“enter a number”).h> . k=n. # include <stdio.i++) { for(s=1. else printf(“given number is not Armstrong %d”.&n). printf(“enter a number of rows”).h> # include<conio. clrscr( ).k. } getch( ).s++) printf(“ ”).35 # include <stdio. } getch().n.j<=i. for(i=1.s.n.&n). while(n>0) { r=n%10.i<=n.k). scanf(“%d”. s=s+(r*r*r).s<=40-i. for(j=1.h> # include <conio. scanf(“%d”. n=n/10. Program to read data in 3 structures and print # include<stdio.r.

printf(“enter code.b1. printf(“\n”).code.piece.&b2.code.&b1. printf(“enter code.i<4. Program to copy contents of one file into another. for(i=0.&b3.piece.code. } getch().price).&b3.b3.&b1.b3. printf(“\n %c%d%f”.piece. printf(“\n %c%d%f”.b2. for(i=0. Program to print a diagonal matrix. main( ) { clrscr( ).piece. float price.i++) { for(j=0. struct book b1.a[i][j]). scanf(“%c%d%f”. int piece. printf(“the details are”). else a[i][j]=0.price”).36 main( ) { struct book { char code.b3.price). getch( ).piece.i. #include<conio.j++) if(i==j) c[i][j]=7.b1.code.&b3. } 69.b2. .j<4.b2. scanf(“%c%d%f”.price).price).i++) for(j=0.j. } 68.price”).&b1.h> main() { int a[4][4]. scanf(“%c%d%f”. clrscr( ).i<4.price). printf(“enter code.code.price).j<4.&b2.&b2.b3.piece.h> #include<stdio.piece.piece. printf(“\n %c%d%f”.price”).j++) printf(“%d”.code.b1.piece.b2. }.

h> main( ) { FILE *fp1. printf(“enter the number”). fclose(fp1). fclose(fp2). Program to create a file of number and copy odd number into second file and even number into third file.”w”). fp1=fopen(“text1”. fcolse(fp3). } .&i).*fp2. else putw(i.fp2).fp1).h> #include<conio.h> #include<conio. while((ch=getchar( ))!=EOF) putc(ch.”w”).”w”).h> main( ) { FILE *fp1. #include<stdio. fp2=fopen(“text2”.”r”). getch( ). scanf(“%d”. } fcolse(fp1). char ch. } 70. while((ch=getc(fp1))!=EOF) putc(ch. fp1=fopen(“DATA1”.*fp3. printf(„enter the text”).”w”). fp1=fopen(“text1”.*fp2.”r”).fp2). getch( ). fp3=fopen(“DATA3”.37 #include<stdio. fp2=fopen(“DATA2”. fcolse(fp1).fp3).”w”). fcolse(fp2). while((i=getw(fp1))!=EOF()) if(i%2= =0) putw(i. fp1=fopen(“DATA1”. while(i!=eof( )) { putw(i. int i.fp1).

no of rooms.ht[i].i<n. int rc.h> main( ) { struct hotel { char name[20]. scanf(“%d”.ht[i]. printf(“enter no. Program a structure which stores information about hotels which stores information about name.rc.nr). struct hotel ht[20].nr).j++) { t=ht[j]. printf(“enter name of city \n”). gr=getche(). b) b) Print the hotels with roomchange less than a given change.ht[i].i++) if(gr==ht[i]. ht[i].grade=getche( ). room change.n. } for(i=0.j<n-i. printf(“enter the grade \n”). char grade.&ht[i].rc). ht[j+1]=t. clrscr( ). }.h> #include<conio.c.name). grade.i++) for(j=0. char gr.i<n. scanf(“%d”.i++) { printf(“enter name of hotel \n”).38 71. getch().&n). printf(“hotel name city grade roomcharge no of room”). scanf(“%s”. char city[10]. int i. printf(“enter room charge \n”). for(i=0.name.nr.grade).grade. clrscr().j. } printf(“enter a grade to print the hotels \n”).i<n.t. a) a) Print the hotels of given grade in order of roomchange.&ht[i].ht[i]. scanf(“%s”. scanf(“%d”.city.ht[i]. for(i=0. ht[j]=ht[j+i].&ht[i]. . printf(“enter no of rooms \n”).&ht[i].ht[i].city). #include<stdio. of hotels\n”).grade) printf(“%s %s %c %d %d”. scanf(“%s”.

i. #include<stdio.h> main( ) { int a[10].i++) printf(“%d”.ht[i]. Program which does the below process after reading on odd no of integer. printf(“hotel name city grade roomcharge no of rooms”).i++) printf(“%d”.name. .rc.n. } 73.&c).rc) printf(“%s %s %c %d %d”.ht[i]. scanf(“%d”.39 printf(“enter a room charge to print hotels less than given charge \n”). getch(). for(i=0. d) d) Replace all –ve no‟s by zero‟s.i++) if(c<=ht[i].ht[i].i++) { scanf(“%d”. for(i=0.a[i]). printf(“\n the given areay after replacing 2nd element is”).a[i]).i<n.sum=0.i<n. } 72. printf(“enter the elements”).ht[i]. printf(“enter the array sixe “).i<n. for(i=0. a[(1+n/2)]=sum/n.city. Program to sort the entered elements using selection sort technique.i++) printf(“%d”.grade. for(i=0. b) b) Replace second elements by product of first and last element c) c) Replace middle value by average of all elements.i<n.&a[i]). clrscr( ).h[i]. sum=sum+a[i].i<n. a[2]=a[1]*a[n-1]. for(i=0.&n). printf(“\n given array after replacing –ve values by zero”). scanf(“%d”. printf(“\n”).a[i]). } printf(“The given arrays is: “). printf(“\n the given array after replacing middle element by average of all”).h> #include<conio. a) a) Print them in given order.i<n.i++) if(a[i]<0) a[i]=0. for(i=0.nr).

evensum=0. getch( ).i++) printf(“%2d”.h> main( ) { int a[100]. clrscr(). } t=a[i].40 #include<stdio.i<n. scanf(“%d”.n. a[i]=a[pos]. #include<stdio. for(i=0. pos=i.j.i++) scanf(“%d”.j<n-1.n.oddsum=0. } printf(“the sorted elements are”).div.i<n. scanf(“%d”.h> main( ) { int a.b. while(a>0) { oddsum=oddsum+(a%10). b=n/10.i<n. a=n. printf(“enter the elements”).h> #include<conio.i. printf(“enter the array size”).j++) if(min>a[j]) { min=j.pos. Program to find whether a number is divisible by „11‟ or not without actual division. } while(b>0) { . printf(“enter a number”).i++) { min=a[i].&a[i]).t. } 74.&n). clrscr( ). a=a/10.&n). pos=j. for(j=0.min.h> #include<math. a[pos]=t.a[i]). for(i=0. for(i=0.h> #include<conio.

printf(“\n maximum=%d”. printf(“minimum=%d”.n. #include<stdio. for(i=0.max.&n). } 76.min. Program to print the following series until there sum exceeds 2.i<n.max).6 term value exceeds 1. printf(“enter x value”).i<n. max=a[i].5 x+x2/2!+x3/3!+------------. clrscr( ). Program to find maximum and minimum of entered ‟n‟ number using arrays.h> main( ) { int i.sum=0.a[10].h> main( ) { float x. } 75. clrscr( ).i++) if(min>a[i]) min=a[i].min). scanf(“%d”. . printf(“ enter how many number”). scanf(“%f‟.41 evensum=evensum+(b%10). max=0. for(i=0. for(i=0.i++) if(max<a[i]).&x).i++) scanf(”%d”.&a[i]). int i.h> #include<conio. #include<stdio. getch(). else printf(“The number is not divisible by 11”). b=b/10.i<n.h> #include<conio.prod=1. getch( ). printf(“enter the elements”). min=a[0]. if(div%11==0) printf(“The number is divisible by 11”). } div=abs(evensum-oddsum).

42 i=1.5)) { prod=prod*(x/i).6) { sum=sum-prod. } printf(“sum=.i++) scanf(“%d”. clrscr(). printf(“enter the any 20 no of range(1-25)). else if((a[i]>5)&&(a[i]<11)) n2++. class intertval frequency 1-5 1-5 6-10 6-10 11-15 11-15 16-20 16-20 21-25 21-25 #include<stdio.n4=0.&a[i]).i<=20. for(i=1.n3=0. } getch( ). if(sum>2. The marks range form 1-25. if(prod<=1. .i.n5=0.i<=20. else if((a[i]>10)&&(a[i]<16)) n3++. else if((a[i]>15)&&(a[i]<21)) n4++. Program to print a frequency distribution table for a class of 20-students in the following format. while((sum<2. else if((a[i]>20)&&(a[i]<26)) n5++.sum).h> #include<conio. } 77.h> main( ) { int a[20]. break. i++.i++) if((a[i]>=1)&&(a[i]<6)) n1++.n1=0. for(i=1.n2=0.5) sum=sum+prod.6)&&(prod<=1.%f‟.

for(i=0.n5). #include<stdio.i++) { printf(“enter values for a[%d]:”.n2). } frequency”). for(i=4.i<=4. %d”. . %d”.z[i]). void print_array(int y[]). clrscr(). Program to accept values into an array and print array in reverse and original format by using three different functions. read_array(a).43 printf(“class interval printf(“\n 1-5 printf(“\n 6-10 printf(“\n 11-15 printf(“\n 16-20 printf(“\n 21-25 getch(). getch( ).h> void read_array(int x[]).i>=0. void rev_array(int z[]). } void rev_array(int z[]) { int i. for(i=0.y[i]). } 79.n3).i++) printf(“%d”.i). } void read_array(int x[]) { int i.&x[i]).i--) printf(“\n%d”. %d”. Program to accept values into single dimensional array and print the array in reverse by using pointers. 78. scanf(“%d”. %d”. %d”. printf_array(a).h> #include<conio.n1). rev_array(a).i<=4.n4). main() { int a[5]. } } void print_array(int y[]) { int i.

i++.nc).s[i]).*b).l.”.nc=0. for(i=0.i).i++) { printf(“\n%d”.h> #include<conio. gets(s). b=&a[0].h> #include<string. clrscr( ). #include<stdio.44 #include<stdio.i++) { printf(“enter a value for a[%d]. .i.h> main( ) { int a[5]. while(s[i]!=‟ „) { nc++.h> main( ) { char s[100]. } printf(“\t\t %d”.i++) { if(s[i]!=‟ „) { nc=0. Program to read a string and print the number of characters in each word of the string. } getch( ). if(s[i]=‟\0‟) break. b-.i<l.i<=4.b). l=strlen(s).*b. printf(“%c”. scanf(“%d”. b++. printf(“enter the sting”).i<=4. for(i=0. int i. for(i=0.. clrscr( ). } b=&a[4].h> #include<conio. } 80.

} 82.(*pt=getchar( ))!=‟\n‟. getch( ). return *pt1-*pt2. char *pt2). Program to accept two strings and compare those two strings #include<stdio. if(strcomp (line1.45 printf(“\n”). main( ) { char line [80].”).h> #include<conio.line2[80]. #include<stdio. } int strcomp (char *pt1. else if(strcomp (line1. read-string (line1). } } getch(). void read-string(char*pt). read-string(line2). *pt=‟\0‟.pt++). printf(“enter second string”). } 81.h> int strcomp (char *pt1. printf(“enter first string. } void read-string(char*pt) { for(.h> #include<conio. char *pt2) { for(.h> . Program to accept a string using pointers and functions.line2)>0) printf(“second string biggest”).pt1++.*pt1!=‟\0‟.”). else printf(“both the strins are equal”).pt2++) if(*pt1!=*pt2) break.line2)>0) printf(“ first string biggest. clrscr( ).

gets(s).h> #include<conio.h> main( ) { int a. } void read_string (char*pt) { for(. printf(“enter a string”).46 main( ) { int ch[20].(*pt=getchar( ))!=‟/n‟. printf(“%s”. clrscr( ). clrscr ( ). read_array(ch). #include<stdio.i++) { if(s[i]!=‟ „ && s[i]=‟ „) { printf(“%c %c”. .ch).l=strlen(s).s[i+1]) i=i+2.l.Program to accept two numbers and print the sum of given two numbers by using pointers #include<stdio. while(s[i]!=‟ „) i++. } 83.s[i]. clrscr( ). } 84. for(i=0.Program to read a string and print the first two characters of each word in the string. printf(“enter a string”). int i. *pt=‟\0‟. } } getch( ).i<l. a=10. b=20.h> main( ) { char s[100].pt++).h> #include<conio. b. getch( ).c.

void printline (char str[].int i). printline(str. printline(str.i++).i<3. printf(„is the revefrse string”).i++) for(j=0.i.j<=0.47 c=*(&a)+*(&b).. getch( ).j--) printf(“%c”.i<80&&((str[i]=getchar())!=‟\n‟).j++) { printf(“enter two values for a[%d][%d] & b[%d][%d]:”.1).j.&b[i][j]). } 86.”).h> int getline (char str[]).1). #include<stdio.h> main( ) { int a[3][3]. return i. 1=getline(str ). clrscr( ).Program to accept a string and print reverse of the given string by using functions.i. if(str[i]=‟\0‟. } int getline(char str[]) { int 1. } void printline(char str[].i.h> #include<conio.c[3][3].j.j).str[j]). printf(“enter a string. printf(“%d”.&a[i][j]. clrscr( ).b[3][3]. for(j=1. Program to accept two 3 dimensional array and store subtraction of those two arrays into third array.j<3. int 1. scanf(“%d%d”. #include<stdio.h> #include<stdio.c). for(i=0.int 1) { int j. getch ( ). } 85. for(i=0. main( ) { char str[80]. .

c[i][j]). for(i=0.i<=4. main( ) { char str1[80].b).h> #include<conio.i) scanf(“%d”. } getch( ). clrscr( ).48 } for(i=0. printf(“%d”. b=&a[0].*b.i<=4. b++. int len1.Program to accept a single dimensional array and print them by using pointers #include<stdio.i. } getch( ).i++) { for(j=0.80). } 88.len2.j++) { c[i][j]=a[i][j]-b[i][j]. clrscr( ).i++) { printf(“enter the a value for a[%d]”.h> int getline(char line[]. len1=getline(str1. printf(“enter first string”). } b=&a[0].h> main( ) { int a[5]. .i<3.Program to accept two strings and biggest among them #include<stdio.h> #include<conio. } printf(“\n”).j<3.str2[80].int lim). for(i=0.. 87.i++) { printf(“\n%d”. b++.*b).

j. printf(“enter constant number”). } 90.Program to print 4 dimentional matrix with constant number.j<4.j++) a[i][j]=c.49 printf(“enter second string”).h> #include<stdio. for(Ii0. return i.i. printf(“\n”).Prongram to accept a string and print each word in reverse #include<conio.i++) if(line[i]==‟\n‟) line[i]=‟\0‟. for(i=0.h> main( ) { int a[4][4]. else printf(“both strings are equal”).c.i<4. len2=getline(str1. } int getline(char line[].j++) printf(“%d”.&c).80). . else if(len1<len2) printf(“second string bigger than first string”).h> #include<conio.int lim) { int i.i++) { for(j=0. scanf(“%d”. getch( ).h> main( ) { char name[80]. if(len1 >len2) printf(“first string bigger than second string”). clrscr( ).j<4. } 89.i<4.i++) { for(j=0. #include<stdio.a[i][j]). for(i=0. } getch( ).i<lim && ((line[i]=getchar( ))!=‟\n‟).

while((end--)>=start) { printf(“%c”.i). void print_array(int z[]).j<=9.i<len.j. void sort_array(int y[]).i<80 &&((name[i]=getchar( ) )!=‟\n‟). scanf(“%d”. print_array(a).len.&x[i]). scanf(“%s”.k. } void read_array(int x[]) { int i. for(i=0.i++) { printf(“enter value for a[%d]”. clrscr( ).j. for(i=0.start=0. getch( ).h> void read_array(int x[]). #include<conio.name[end]).end.name). } 91. } getch( ). } start=i+1. } } void sort_array(int y[]) { int i. sort_array(a). for(i=0. printf(“enter a string”).i++) if(name[i]==‟ „|| name[i]==‟\n‟) { end=i.i<9.50 int i. len=i.i++) for(j=i+1.j++) if(y[i]>y[j]) .h> #include<stdio. read_array(a). Program to accept elements into single dimensional array and print the array in ascending order by using three different arrays.i<10. clrscr( ).i++). main() { int a[10]. for(i=0.

char c.dat”. while(1) { c=getchar( ). y[i]=y[j].h> #include<stdio. y[j]=k. } } void print_array(int z[]) { int i. } 92. putc(c).z[i]). printf(“enter text”). for(i=0. clrscr(). if(c==eof( )) break. #include<conio. fclose(fp). #include<conio.h> #include<stdio. } 93.51 { k=y[i]. putchar(c).”r”).”w”).h> main( ) . while(1) { c=getc(fp). if(c==eof( )) break. } getch( ).Program to accept data and store the given data into file print the data.i++) printf(“%d\n”.i<10. fp=fopen(“data. fp=fopen(“data.h> main( ) { FILE *fp.dat”. Program to accept data in lower case and store the given data into file into upper case and print the data. } fclose(fp).

while((ch=getc(fp1))!=EOF) putc(ch. fp1=fopen(“text1”. } 95. getch( ). fcolse(fp2).”r”).”w”). if(c==eof( )) break. fcolse(fp1).Program to copy contents of one file into another.dat”. fp=fopen(“data2. printf(“enter text”). while((ch=getchar()!=EOF).”w”).fp) } fclose(fp). } 94.h> #include<stdio.h> main( ) { FILE * fp1. putchar(c).fp1). fp=fopen(“data2.h> . fp2=fopen(“text2”. } getch( ). fclose(fp1).”r”). Program to create a file of numbers and copy odd number into second file and even number into third file #include<conio. fp1=fopen(“text1”. putc(ch.”w”).52 { FILE *fp.fp2). printf(“enter the text”).dat”. Char c. clrscr( ). while(1) { c=getc(fp). fclose(fp).*fp2. while((c=getchar( ))!=eof( )) { putc(toupper(c).h> #include<stdio. char ch. #include<conio.

fp1=open(“data1”.h> #include<stdio. while(i!=eof) { putw(i. printf(“%c”. printf(“enter the number”).i++) { str1[0]-=32.&i). fp2=fopen(“data2”.Program to accept a string in lower case and print first character of each word in upper case. fcolse(fp3).”w”). clrscr( ).fp2). fp3=fopen(“data3”.fp3). fcolse(fp2). #include<conio. length=getline(str1.*fp2.”w”).fp1). while((i=getc(fp1))!=eof) if(i%2==0) putc(i.i<length. int length. for(i=0. .80). scanf(“%d”. if(str1[i]= =‟ „) str1[i+1]-=32. printf(“enter a string. fcolse(fp1).”r”).53 main( ) { FILE *fp1.w”). } 96. scanf(“%d”.str1[i]).i. int i.*fp3. “). } fcolse(fp1). fp1=fopen(“data1”.h> main( ) { char str1[80]. } getch(). int lim) { int i.&i). else putw(i. } int getline(char line []. getch( ).

getch( ).b).54 for(i=0. } 98. printf(“enter value for b. main( ) { int a. } . printf(“\nb=%d”.Program to accept two numbers and interchange two values using functions.”).b).Program for example of static variable.&b). clrscr( ).”).j++). #include<conio. int b).b. c=a.i). main( ) { int j.h> void swap (int a. } 97. fun( ). printf(“enter value for a. return i. getch( ).h> #include<stdio.i<lim && ((line[i]=getchar( ))!=‟\n‟). scanf(“%d”. #include<conio. clrscr( ).h> static int i=1.i++). } void swap(int a. i=i+1. } fun( ) { printf(“\n%d”.a). a=b. swap(a.&a). b=c.h> #include<stdio.int b) } int c. scanf(“%d”. if(line[i]= =‟\n‟) line[i]=‟\0‟. printf(“\na=%d”.j<=5. for (j=1.

h> #include<stdio.h> main( ) { int a[4][4].&c).h> #include<stdio.55 99. clrscr ( ).j<4. printf(“\n”).i<4.Program to accept a string and print by trailing spaces. clrscr( ). } getch( ). } .j.j<4.j++) if(i+j= =3) a[i]]j]=c. else if(n>=‟a‟ && n<=‟z‟) putchar(n).c.i.i++) { for(j=0.”).a[i][j]). printf(“enter which number you want. #include<conio. getch( ).”). printf(“enter a string. } 100. while((n=getchar( )!=‟\n‟) if(n>=‟a‟ && n<=‟z‟) putchar(n). #include<conio.n1.h> main( ) { char n.i++) for(j=0. else a[i][j]=0 for(i=0. for(i=0. Program to print anti diagonal.i<4.j++) printf(“%d”. scanf(“%d”.