You are on page 1of 59

# c

Wed, Sep 30, 2009 at 3:23 PM

-: 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.
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
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 about name, grade, room change, no of rooms.
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.
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.

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()
{

scanf (“%d”. printf(“Sum Of Given Two Numbers are %d”. scanf(“%d”. getch().h> # include <conio. scanf (“%d”. printf(“\n\t STUDENT RNO : %d “. sum=a+b. getch(). . printf (“ENTER STUDENT RNO : “). printf(“ENTER FIRST SUBJECT MARKS :”).&d). Program To Accept Student Roll No. clrscr(). } 3. printf(“ENTER THIRD SUBJECT MARKS :”).b. avg=tot/3. sum.c). # include <stdio.h> main( ) { int a.h> main() { int r.d. printf(“\n\t THIRD SUBJECT MARKS :%d “. printf(“\n\t TOTAL MARKS : %d”. Marks in 3 Subjects and Calculate Total.&b). Average and Print it. printf(“ENTER VALUE FOR B :”).&a). tot). printf(“ENTER SECOND SUBJECT MARKS:”).r). clrscr( ).b.h> # include <conio.&b). sum). Program To Read Three Numbers And Print The Biggest Of Given Three Numbers # include <stdio.&c).c. printf (“ENTER VALUE FOR A : “).b. clrscr (). printf(“\n\t SECOND SUBJECT MARKS :%d “. avg.&r). scanf(“%d”. scanf(“%d”. } 4. avg). scanf(“%d”.d).b). tot. printf(“\n\t AVERAGE MARKS : %d”.c.int a. tot=b+c+d.big=0. printf(“\n\t FIRST SUBJECT MARKS :%d “.

&c). # include <stdio. printf(“ENTER VALUE FOR B:”). # include <stdio. else printf(“the above given number is odd number”).&b). if (c>big) big=c. clrscr(). printf(“enter a year:”). scanf(“%d”.h> main( ) { int y.h> main() { int n. if(b>big) big=b. Program To Read A Number And Find Whether The Given Number Is Even Or Odd. Program to accept a year and check whether the given year IS leap year or not.h> # include <conio.&y). scanf(“%d”. getch().printf(“ENTER VALUE FOR A:”).r. . scanf(“%d”. if(y%4==0& &y%100!=0|| y%400==0). clrscr( ). print(“ENTER VALUE FOR C:”). if(r= = 0) printf(“the above given number is even number”). } 5. printf(“the above given year IS a leap year”). scanf(“%d”. else printf(“the above given year IS not a leap year”).&a). scanf(“%d”.h> # include <conio. } 6. printf (“BIGGEST OF ABOVE GIVEN THREE NUMBER IS %d”. r=n%2. if (a>big) big=a . printf(“ENTER A NUMBER :”). &n).big) getch( ).

} 8. sum. } 7.h> # include <conio.&n). d.getch(). clrscr( ). getch( ). printf (“ Sum of Individual Digits of Given Numbers is %d”. scanf (“%d”. d=b+c. # include <stdio. # include <stdio. b=( (n%100)/10).h> main( ) { int a.h> # include <conio. printf (“ Enter a Three Digit Number:“). getch( ). Program to accept a three digit number and print the sum of individual digits. scanf (“%d”. &a).c. } 9. printf ( “ Enter a two digit number :”). scanf (“ %d”. c. d). a=n/100. b.c. printf (“sum of individual digits of given numbers id %”.n. c=n%10. a.h> # include <conio. Individual Digits # include <stdio. Sum).h> main( ) { int n. clrscr( ). .d. clrscr( ). printf (“ Enter a Three Digit Number: “). Program to accept a number and check the given number is Armstrong or not. sum=a+b+c. b=a/10.b.b. c=a%10.h> main( ) { int a. &n).

. getch( ). getch( ).h> # include <conio.h> main( ) { int n. clrscr( ). } 10.h> # include <conio. i>=1. if (n= =d) printf (“The Given Number is Armstrong number”).h> main( ) { int i.h> # include <conio. i--) printf(“%d\n”. else printf (“The Given Number is Not Armstrong number”). i+=2) printf(“%d\n”. Program to print ODD numbers from 1 to 10 # include <stdio. # include <stdio.i). getch( ).i.sum=0. clrscr( ). d=a*a*a*+b*b*b +c*c*c. c=n%10. } 11. clrscr( ).h> main( ) { int i. i<=10. for (i=10.a=n/100. Program to print natural numbers from 1 to 10 in Reverse # include <stdio. } 12.i). Program to print sum of the natural numbers from 1 to 10. for (i=1. b=((n/10)%10).

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

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

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

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

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

clrscr( ).h> main( ) { char ch. # include <stdio.h> # include <conio. ch=getchar(). clrscr( ). ch=getchar(). else if(ch>=97 && ch<=122) c1=ch-32. # include <stdio. printf(“the given char in anothercase IS”). putchar(c1). leap=(y%400= =0)?:(y%100!=0)?(y%4= =0)?1:0:0. Program to accept a character in any case and print in another case. getch(). } .c1.clrscr( ). putchar(c1).&y). printf(“enter a char in anycase”).h> # include <conio. } 25. c1=ch+32. printf(“the given char in lowercasecase is”). else printf(“given year is not leap year). } 26. Program to accept a character in the uppercase and print in lower case. getch(). printf(“enter a cha in uppercase”).c1. if(ch>=65 && ch<=90) c1=ch+32.h> main( ) { char ch. scanf(“%d”. getch( ). printf(“enter any yr”). if(leap= =1) printf(“ the given year is leap year”).

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

} 32. else putchar(ch). Program to accept a string and count no of capital letters. # include <stdio.h> main( ) { char ch. getch( ). while(( ch=getchar( ))!=’\n’) { if(ch>=’A’ && ch<=’Z’) putchar(ch+32). } printf(“ is the string”). clrscr( ). # include <stdio. if(ch= =’ ‘) printf(“\n”). } 30. } getch( ). getch( ).h> # include <conio.h> # include <conio. while(( ch=getchar( ))!=’\n’) { putchar(ch). else if(ch>=’a’ && ch<=’z’) putchar(ch-32). of small letters and . } 31. clrscr( ).printf(“ is in lower case”).h> main( ) { char ch. no. Program to accept a string print each word in new line. printf(“enter a string :”). Program to accept a string in any case and print it by another case . printf(“enter a string :”).

of special characters # include <stdio. scanf(“%d “.h> # include <conio. } printf(“ no of capital letters are %d”.h> main( ) { char ch. break. case 4: printf(“FOUR”). case 3: printf(“THREE”).h> # include <conio. else s1=s1+1.s). . break.c). int c=0. printf(“ no of special characters are %d”. break. clrscr( ). while(( ch=getchar( ))!=’\n’) { if(ch>=’A’&& ch>=’Z’) c=c+1.no. printf(“enter a string :”). getch( ). clrscr( ).h> main( ) { int n. break.&n). printf(“ no of smal1 letters are %d”. } 33. case 2: printf(“TWO”).s1). case 1: printf(“ONE”). printf(“enter a number :”). break. else if(ch>=’a’&& ch>=’z’) s=s+1. Program to accept any single digit number and print it in words . switch(n) { case 0: printf(“ZERO”). # include <stdio.s1=0.s=0.

n<=i/2. break. break. else printf(“\n %d is not a prime”.i). default: printf(“please enter the number between 0 and 9”). clrscr(). case 7: printf(“SEVEN”). } 35.n++) if(i%n= =0) { check=0. break. break.i<=100. case 9: printf(“NINE”).i++) { check=1. break. case 8: printf(“EIGHT”). } getch( ). break.h> main( ) { . } getch( ). Program to print prime numbers between 1 to 100 # include <stdio. for(n=2.h> main( ) { int n. } if(check= =1) printf(“\n %d is a prime”.case 5: printf(“FIVE”). } 34. case 6: printf(“SIX”).h> # include <conio. for(i=1.h> # include <conio.i). Program to accept two numbers and print sum of two numbers by using functions # include <stdio. check. i.

c.b). printf(“enter the value for b:”) scanf(“%d”. int y) { int z. printf(“enter the value for a:”) scanf(“%d”.int a. return fa. c=add(a.f.i--) fa=fa*i.b. return z. clrscr( ).h> main( ) { . clrscr(). } 37. } int fact(int n) { int i. fa=1. Program to accept a number and find factorial of given number # include <stdio.h> # include <conio. Program to accept a number and check the given number Armstrong or not # include <stdio. printf(“factorial value is %d”. getch( ).c).&b). printf(“sum of two numbers is %d”.&n).&a). z=x+y. } int add(int x. for(i=n. f= fact(n).h> main( ) { int n.h> # include <conio. printf(“enter a number:”) scanf(“%d”. getch().f).i>=1. } 36.

arm.h> main( ) { int a. a=rev(n). c=n%10. return d.d. arm= armstrong(n). a=n/100.h> # include <conio. Program to accept a number and print the sum of given and Reverse number # include <stdio. printf(“REVERSE OF A GIVEN NUMBER IS %d”. else printf(“%d not a Armstrong number”.s. } int rev( int n) { int r. printf(“enter a number:”) scanf(“%d”. while(n>0) { r=n%10. printf(“enter any 3 digit number:”) scanf(“%d”.b. n=n/10. b=add(n. getch( ). clrscr( ).a).n). printf(“\n sum of a given and reverse number is %d”. d=a*a*a+b*b*b+c*c*c.int n. rev=rev*10+r. } 38.b).a).c.&n). b=((n/10)%10). } int Armstrong (int n) { int a.b.rev=0. } . getch( ). if(arm= =n) printf(“%d is Armstrong number”. clrscr().n.n).&n).

i--) printf(“\nA[%d]=%d”.i<=4. int a) { return n+a. for(i=0. scanf(“%d”.i. if(name[i]= =’\n’) name[i]=’\0’.a[i]).i++).h> # include <conio.h> main( ) { int i.i<80 && ((name [i]= getchar())!=’\n’). } int add(int n. for(j=i. clrscr( ).j--) putchar(name[j]). printf(“ enter a string”). } .&a[i]).return rev. printf(“is the reverse of given string”).i.h> main( ) { int i.i). getch( ).i<10. } 40.a[10]. Program to accept a string and print the reverse of the given string by using for loop. gets(name). } 39. # include <stdio. Program to accept 10 numbers and print first five numbers in original order and print last five numbers in reverse order.j. } for(i=0.i++) { printf(“enter value for a[%d]”. for(i=0. char name[80].h> # include <conio.i++) printf(“\nA[%d]=%d”.i>=5. for(i=9. getch( ).j>=0.a[i]). # include <stdio.

} for(i=0.check=1.lim--) if(word[i]!= word[lim]) { check=0. # include <stdio.h> # include <conio. for(i=0.j<=2.i. clrscr( ).&a[i][j]). printf(‘\n”). for(i=0.j.i++. char word[80].i<=2.h> main( ) { int i.j++) { printf(“ enter the value for a[%d][%d] :”.a[i][j]).j<=2.41.lim.i++). lim=i-1. Program to accept a string and check the given string is palindrome or not .i<=0. getch( ).c. } if(check= =1) printf(“the given string is palindrome “).j). clrscr( ).i<80 && ((word [i]= getchar())!=’\n’).h> main( ) { int a[3][3]. for(i=0.i++) { for(j=0. printf(“ enter a string”). # include <stdio. } 42.h> # include <conio. else printf(“ not palindrome”). c=lim/2.i<=2. } .Program to accept values into 3 dimensional array and print .i++) for(j=0.i. scanf(“%d”.j++) printf(“ %d:”. break.

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

printf(“ enter a string”). Program to count the number of words. printf(“length of the given string is %d”. characters. printf(“enter 2 lines of text”).h> #include<conio. getch ( ).s[100]. } getch( ). #include<stdio.i++) { switch(s[i]) . for(i=0. consonants and digit in a line of text. gets(s).nov=0. } printf(“\n”). clrscr( ). alphabets. l=strlen(s). if(str[i]= =’\n’) str[i]=’\0’.h> main( ) { int noa=0.h> # include <conio.c[i][j]). return i.noch=0. clrscr( ). vowels. int length.now=0.h> int getline(char str[]). for(i=0.nob=0.l. } int getline(char str[]) { int i. } 46. char ch.I. Program to accept a string and find the length of the given string by using functions # include <stdio.i<1.noc=0.i<80&&((str[i]=getchar( ))!=’\n’).printf(“%d”. } 45. i++). length=getline(str).length). main( ) { char str[80].

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

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

ny. year and print the next day’s date.28.nm.print(“%d”.31.month.a[i]).30. } 50. printf(“enter the date.h> # include <conio. nm=m. Program to read date.31.nm. clrscr( ). } if(nm>12) { nm=1. nm++. } printf(“Given date is %d:%d:%d\n”. getch( ).d.h> main( ) { int month[12]={31.m.30. getch( ).y).year”). ndays=month[m-1].nd. ny=y.year.&y).month.31.nd.31}. if(nd>ndays) { nd=1. Program to interchange two values using pointers.31.ndays. scanf(“%d%d%d”. if(m==2) { if(y%100==0) { if(y%400==0) ndays=29.&m. } else if(y%4==0) ndays=29.y. # include <stdio.month. printf(“next days date is %d:%d:%d”.&d. } 49. int d.m.ny).30. . ny++.31.30. } nd=nd+1.

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

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

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

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

k++) c[i][j]=c[i][j]+a[i][k]*b[k][j]. if(c==2) printf(“\n%d”. } getch( ).i<m.j<n.n. } printf(“the multiplication matrix is”).h> main( ) { int i. for(n=1.j<q. } } else printf(“multiplication is not possible”).k<n.c[i][j]). for(i=1.n<=100.i<=n. getch( ). } 58. clrscr( ).i++) for(j=1. for(i=1.n). for(k=1.j<n. printf(“\n”).i++) for(j=1. Program to accept a string and find the length of the string . } 59.n++) { c=0.c. for(i=1.&b[i][j]).j++) scanf(“%d”.j++) { c[i][j]=0.i<m. for(i=1.j++) print(“%2d”. Program to print prime number between 1-100 # include <stdio.i++) { for(j=1.i++) if(n%i==0) c++.i<p.printf(“enter second matrix elements”).h> # include <conio.

h> # include <conio. result print them in a particular format.j<=n. printf(“%d is the size of string”. Program to fibanocci of matrix # include <stdio.n sum=0.”). printf(“norm=%f”.h> main( ) { struct student { char name[20].&a[i][j]). scanf(“%d%d”. getch( ). getch( ). printf(‘enter the matrix size”). sum=sum+(a[i][j]*a[i][j]) } norm=sqrt(sum). } 61. # include <stdio.i++). } 60.j.i). float norm.i<=m.h> # include <math.i++) for(j=1. printf(“enter the element of matrix”). clrscr( ).h> main( ) { char name[80]. int i.h> main( ) { int a[10][10]. clrscr( ).i<80&&((name[i]=getchar( ))!=’\n’).i.h> # include <conio.norm).3 subjects marks) and calculate total marks.&m.# include <stdio.m. printf(“enter a string . for(i=1.h> # include <conio.&n).j++) { scanf(“%d”. . for(i=0. Program a structure which reads ‘n’ students information (name.

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

for(i=1.c. } 64.i<=m. # include <stdio.c=1.h> #include <conio. else printf(“none of two”).j++) printf(“%4d”. area.&c). getch( ). printf(“\n”).b. clrscr( ).area).h> main( ) { int a. scanf(“%d%d%d”.&b. } 63.a[i][j]).i++) { for(j=1. printf(“area=%.h> . else s=(a+b+c)/2. } printf(“the given matrix is \n”). if((a+b)<c||(b+c)<a||(a+c)<b) printf(“finding area is not possible”). #include<stdio. } getch( ).2f”. } if(c==0) printf(“the given matrix is symmetric”). float s. printf(“enter there sides of the triangle”). else if(c1==0) printf(“the matrix is skew symmetric”).j<=n. area=sqrt(s*(s-a)*(s-b)*(s-c)). else if(a[i][j]==a[j][i]) c1=1.h> # include <conio. Program to print Armstrong number between 1-500. Program to find area of a triangle when there sides are given.&a.

s=0. Program to check whether a given number is Armstrong or not. k=n.s. clrscr( ).r. n=n/10. clrscr( ).i<=500. s=s+(r*r*r). .k. scanf(“%d”.k).h> # include <conio. while(n>0) { r=n%10.r. } if(k==s) printf(“given number is Armstrong %d”.k). # include <stdio. } getch(). s=s+(r*r*r).main( ) { int i.&n).s.n. Program to print the floyd’s triangle. } if(i==s) printf(“\n%d”. s=0. } 65.i++) { n=i.n.s). while(n>0) { r=n%10. } 66. else printf(“given number is not Armstrong %d”. for(i=1. printf(“enter a number”).h> main( ) { int i. } getch(). n=n/10.

b3.&b1.k++).price).h> main( ) { struct book { char code.piece.h> main( ) { int i.price).&b1.b3.price”).j++) printf(“%3d”.b2.code. for(i=1.h> # include<conio.s++) printf(“ ”).code.&b2.j<=i. .price).b2. printf(“\n %c%d%f”.price). printf(“\n %c%d%f”.piece. Program to read data in 3 structures and print # include<stdio.code.b2. getch( ).price).&b2.piece.code.code. for(j=1. printf(“enter code. scanf(“%d”.piece.&b3.b1.n.piece. printf(“enter code. struct book b1. clrscr( ).price).i<=n. printf(“enter code.b2.&b2. }.# include <stdio.r k=1.code.piece. printf(“the details are”). printf(“\n %c%d%f”.price”).b3.s<=40-i.piece.b1. int piece. } getch( ).&b3.&b1.&n).h> # include <conio.b3. printf(“\n”).i++) { for(s=1. printf(“enter a number of rows”).piece.price”). scanf(“%c%d%f”. } 67. float price.piece.b1. scanf(“%c%d%f”.&b3. main( ) { clrscr( ). scanf(“%c%d%f”.s.

i++) for(j=0. fp2=fopen(“text2”.”r”).i<4. #include<conio.j<4. } 69. printf(‘enter the text”). } .h> main( ) { FILE *fp1.i. fclose(fp2). fp1=fopen(“text1”. for(i=0. printf(“\n”). while((ch=getchar( ))!=EOF) putc(ch.j.i<4.”w”).} 68. fp1=fopen(“text1”. else a[i][j]=0. clrscr( ). fclose(fp1). for(i=0.i++) { for(j=0.a[i][j]).”w”). getch( ).h> #include<conio.fp1).h> main() { int a[4][4]. while((ch=getc(fp1))!=EOF) putc(ch. Program to print a diagonal matrix.j++) printf(“%d”.j++) if(i==j) c[i][j]=7. Program to copy contents of one file into another. } getch().fp2).*fp2.h> #include<stdio. char ch. #include<stdio.j<4.

nr. int rc.&i). getch( ). char grade.fp2). no of rooms. struct hotel ht[20]. char city[10]. #include<stdio. while((i=getw(fp1))!=EOF()) if(i%2= =0) putw(i. fcolse(fp1). a) a) Print the hotels of given grade in order of roomchange.fp1). int i. else putw(i. fp3=fopen(“DATA3”.70. room change.h> #include<conio.”w”). fp1=fopen(“DATA1”.h> main( ) { struct hotel { char name[20]. fcolse(fp3).t. . b) b) Print the hotels with roomchange less than a given change. while(i!=eof( )) { putw(i. fp2=fopen(“DATA2”.h> main( ) { FILE *fp1. printf(“enter the number”). } fcolse(fp1).”w”).fp3).”r”). scanf(“%d”.*fp2.”w”). } 71. fcolse(fp2). Program a structure which stores information about hotels which stores information about name.h> #include<conio. fp1=fopen(“DATA1”. }. grade. Program to create a file of number and copy odd number into second file and even number into third file.*fp3. #include<stdio.

ht[i].i++) if(c<=ht[i].i<n.n.rc.city.i++) { printf(“enter name of hotel \n”).nr).&ht[i].name. for(i=0. a) a) Print them in given order.j.&n).ht[i]. printf(“hotel name city grade roomcharge no of room”). for(i=0. char gr.&ht[i].grade.j<n-i. scanf(“%d”.ht[i].nr). ht[i].&ht[i].&c). d) d) Replace all –ve no’s by zero’s.ht[i]. printf(“enter name of city \n”). Program which does the below process after reading on odd no of integer.c. printf(“enter the grade \n”).city. of hotels\n”).j++) { t=ht[j].grade) printf(“%s %s %c %d %d”. printf(“enter a room charge to print hotels less than given charge \n”). printf(“hotel name city grade roomcharge no of rooms”). printf(“enter no of rooms \n”). scanf(“%s”. getch().nr). scanf(“%s”.name).i<n. scanf(“%d”. scanf(“%d”.int i..i<n. gr=getche().grade=getche( ).grade). scanf(“%d”.rc.&ht[i]. .city).rc). } printf(“enter a grade to print the hotels \n”). b) b) Replace second elements by product of first and last element c) c) Replace middle value by average of all elements. scanf(“%s”.ht[i]. clrscr().name. clrscr( ). printf(“enter no. printf(“enter room charge \n”). ht[j+1]=t.ht[i]. } 72.i++) if(gr==ht[i].ht[i].ht[i]. ht[j]=ht[j+i]. } for(i=0.h[i]. for(i=0.i++) for(j=0.grade.ht[i].ht[i].i<n.rc) printf(“%s %s %c %d %d”.

#include<stdio.min.&n).n.i<n. for(i=0. clrscr( ). a[(1+n/2)]=sum/n.i<n.&a[i]). clrscr().h> main( ) { int a[10].&n). sum=sum+a[i].i. for(i=0.i++) { scanf(“%d”. printf(“enter the elements”). printf(“\n the given array after replacing middle element by average of all”).i++) printf(“%d”. for(i=0. for(i=0. scanf(“%d”.n. scanf(“%d”.i++) scanf(“%d”.i++) if(a[i]<0) a[i]=0. for(i=0.a[i]).a[i]).&a[i]).a[i]). printf(“enter the array sixe “).h> #include<conio.i<n. } printf(“The given arrays is: “).i.i<n. printf(“\n the given areay after replacing 2nd element is”). printf(“enter the array size”). getch(). printf(“\n”). for(i=0. Program to sort the entered elements using selection sort technique. printf(“\n given array after replacing –ve values by zero”).h> #include<conio.i++) printf(“%d”.pos. for(i=0.sum=0.i++) printf(“%d”. #include<stdio.i++) . } 73. a[2]=a[1]*a[n-1].i<n.j.t.i<n. printf(“enter the elements”).i<n.h> main( ) { int a[100].

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

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

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

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

i++) { printf(“enter a value for a[%d].h> main( ) { int a[5]. gets(s). b-. } b=&a[4].i.l.h> #include<conio.i<l. Program to read a string and print the number of characters in each word of the string. . while(s[i]!=’ ‘) { nc++.i<=4.i<=4.h> main( ) { char s[100].h> #include<conio. } getch( ). clrscr( ). for(i=0. b++. clrscr( ).nc=0. for(i=0.b).*b.i++) { printf(“\n%d”. } 80.h> #include<string. #include<stdio.. scanf(“%d”. b=&a[0].i++) { if(s[i]!=’ ‘) { nc=0.i).”. int i. printf(“enter the sting”).*b).79. #include<stdio. l=strlen(s). Program to accept values into single dimensional array and print the array in reverse by using pointers. for(i=0.

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

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

} int getline(char str[]) { int 1.j--) printf(“%c”.84.Program to accept a string and print reverse of the given string by using functions. getch( ). if(str[i]=’\0’. printf(“enter a string.h> main( ) { int a. a=10. clrscr( ). printf(“%d”. void printline (char str[].h> #include<stdio.c). for(j=1. int 1.h> int getline (char str[]). 1=getline(str ).1). } .int 1) { int j.i<80&&((str[i]=getchar())!=’\n’).j<=0. c=*(&a)+*(&b).str[j]). return i. } void printline(char str[]. clrscr( ).int i). printline(str.c. #include<stdio.i++).”). b.1). main( ) { char str[80]. } 85.h> #include<conio. for(i=0. b=20. printline(str.Program to accept two numbers and print the sum of given two numbers by using pointers #include<stdio. printf(‘is the revefrse string”). getch ( ).

} getch( ).i.i++) for(j=0.h> main( ) { int a[3][3].j<3. b++.*b.i++) { printf(“\n%d”. Program to accept two 3 dimensional array and store subtraction of those two arrays into third array.i. scanf(“%d%d”.i.i<=4.b[3][3].i++) { for(j=0.i<3. } b=&a[0].j.h> #include<conio.i. b++.j++) { c[i][j]=a[i][j]-b[i][j]. 87. for(i=0.c[3][3].h> main( ) { int a[5].i) scanf(“%d”.h> #include<conio.j).b).&b[i][j]). clrscr( ).i++) { printf(“enter the a value for a[%d]”. .&a[i][j].i<=4. } printf(“\n”). #include<stdio.i<3.c[i][j]).j.. for(i=0.86. for(i=0. b=&a[0]. printf(“%d”. clrscr( ).Program to accept a single dimensional array and print them by using pointers #include<stdio.j++) { printf(“enter two values for a[%d][%d] & b[%d][%d]:”.. } for(i=0.*b).j<3.

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

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

while(1) .&x[i]).i).”w”).i++) printf(“%d\n”. read_array(a). fp=fopen(“data. clrscr(). printf(“enter text”).z[i]).dat”. for(i=0.Program to accept data and store the given data into file print the data.i<9. sort_array(a).i++) { printf(“enter value for a[%d]”. char c.j<=9. for(i=0. print_array(a).i++) for(j=i+1. } void read_array(int x[]) { int i.j. y[j]=k. } } void print_array(int z[]) { int i. } 92.i<10. getch( ). for(i=0. #include<conio. scanf(“%d”.j++) if(y[i]>y[j]) { k=y[i].h> #include<stdio.i<10.h> main( ) { FILE *fp. clrscr( ). } } void sort_array(int y[]) { int i.k. y[i]=y[j].{ int a[10].

fp=fopen(“data2. Char c. while((c=getchar( ))!=eof( )) { putc(toupper(c). if(c==eof( )) break.dat”. fp=fopen(“data2.{ c=getchar( ). } 93. putc(c).fp) } fclose(fp). } getch( ). fclose(fp).dat”.h> main( ) { FILE *fp. fp=fopen(“data. if(c==eof( )) break. clrscr( ). putchar(c). fclose(fp).”w”).”r”). putchar(c). #include<conio.”r”). } getch( ). } fclose(fp). printf(“enter text”). Program to accept data in lower case and store the given data into file into upper case and print the data.dat”.h> #include<stdio. if(c==eof( )) break. } . while(1) { c=getc(fp). while(1) { c=getc(fp).

fp2=fopen(“data2”. fp1=fopen(“text1”. fp1=fopen(“text1”. } 95.h> #include<stdio.fp1). fp1=open(“data1”.&i). else .fp3). int i. while((ch=getc(fp1))!=EOF) putc(ch. printf(“enter the text”).h> #include<stdio.&i).”w”).”r”).*fp3. scanf(“%d”. Program to create a file of numbers and copy odd number into second file and even number into third file #include<conio. while((ch=getchar()!=EOF).”w”).”w”). char ch. scanf(“%d”. putc(ch.h> main( ) { FILE *fp1. fp3=fopen(“data3”.”r”). printf(“enter the number”). fclose(fp1).94.w”). while((i=getc(fp1))!=eof) if(i%2==0) putc(i.*fp2. fcolse(fp2).Program to copy contents of one file into another. fcolse(fp1). fp1=fopen(“data1”.h> main( ) { FILE * fp1. fp2=fopen(“text2”.fp1). while(i!=eof) { putw(i. #include<conio.”w”).*fp2. } fcolse(fp1).fp2). getch( ).

i<length. if(str1[i]= =’ ‘) str1[i+1]-=32. fcolse(fp2).”).h> #include<stdio. fcolse(fp3).h> #include<stdio.i++) { str1[0]-=32.i<lim && ((line[i]=getchar( ))!=’\n’).fp2). clrscr( ). getch( ). fcolse(fp1). } int getline(char line []. .i. int lim) { int i. for(i=0. “). printf(“enter a string.h> void swap (int a.putw(i. #include<conio. printf(“enter value for a. clrscr( ).b. main( ) { int a.80). for(i=0.h> main( ) { char str1[80]. } getch(). int b). return i. } 96. if(line[i]= =’\n’) line[i]=’\0’. int length.i++).Program to accept two numbers and interchange two values using functions. length=getline(str1. printf(“%c”. } 97.Program to accept a string in lower case and print first character of each word in upper case. #include<conio.str1[i]).

getch( ). } 99. } void swap(int a. for (j=1. fun( ).h> #include<stdio.j<=5. clrscr( ). printf(“enter value for b. i=i+1. b=c. } 98.i).Program for example of static variable.a).&b).j++). } fun( ) { printf(“\n%d”. a=b. scanf(“%d”. printf(“\na=%d”. printf(“enter a string. main( ) { int j.&a). #include<conio.Program to accept a string and print by trailing spaces.”). . printf(“\nb=%d”.h> main( ) { char n.n1.”).h> #include<stdio.b). getch( ). swap(a. c=a.b).h> static int i=1. while((n=getchar( )!=’\n’) if(n>=’a’ && n<=’z’) putchar(n).int b) } int c. #include<conio. clrscr ( ).scanf(“%d”.

Program to print anti diagonal.j++) if(i+j= =3) a[i]]j]=c.h> main( ) { int a[4][4].h> #include<stdio. } getch( ).j++) printf(“%d”.j. else a[i][j]=0 for(i=0. clrscr( ).c. #include<conio.j<4.&c). printf(“\n”). scanf(“%d”.”).i<4.i++) { for(j=0. for(i=0.i. Try now! .j<4.i<4. printf(“enter which number you want.a[i][j]). getch( ). } 100. } Add whatever you love to the Yahoo! India homepage.else if(n>=’a’ && n<=’z’) putchar(n).i++) for(j=0.