Simple 100 C Programs

February 16, 2017 | Author: Revathi Shankar | Category: N/A
Share Embed Donate


Short Description

Download Simple 100 C Programs...

Description

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 . Page 1 of 65

Page | 1

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 Page 2 of 65

Page | 2

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 Page | 3

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. Page 3 of 65

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.

ANSWERS: 1. Program to print text # include # include main() { clrscr(); printf(“HELLO WELCOME TO VIDYARTHI COMPUTERS”); printf(“Hanamkonda Warangal phone : 0870-2574900, 9849103344”); getch(); Page 4 of 65

Page | 4

} 2. Program To Read Two Numbers And Print The Sum Of Given Two Numbers. # include # include 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 # include 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; Page 5 of 65

Page | 5

printf(“\n\n\t\t VIDYARTHI COMPUTERS – HANAMAKONDA \n\n”); printf(“\t STUDENT RNO ; %d “,r); printf(“\t FIRST SUBJECT MARKS ;%d “,b); printf(“\t SECOND SUBJECT MARKS ;%d “,C); printf(“\t THIRD SUBJECT MARKS ;%d “,d); printf(“\t AVERAGE MARKS ; %d”, avg); getch(); }

Page | 6

4. Program To Read Three Numbers And Print The Biggest Of Given Three Numbers # include # include main( ) {int a,b,c,big=0; clrscr( ); printf(“ENTER VALUE FOR A:”); scanf(“%d”,&a); printf(“ENTER VALUE FOR B:”); scanf(“%d”,&b); print(“ENTER VALUE FOR C:”); scanf(“%d”,&c); if (a>big) big=a ; if(b>big) big=b; if (c>big) big=c; printf (“BIGGEST OF ABOVE GIVEN THREE NUMBER IS %d”,big) getch( ); } 5. Program To Read A Number And Find Whether The Given Number Is Even Or Odd. # include Page 6 of 65

# include main() {int n,r; clrscr(); printf(“ENTER A NUMBER ;”); scanf(“%d”, &n); r=n%2; if(r= = 0) printf(“the above given number is even number”); else printf(“the above given number is odd number”); getch(); }

Page | 7

6. Program to accept a year and check whether the given year IS leap year or not. # include # include main( ) {int y; clrscr( ); printf(“enter a year:”); scanf(“%d”,&y); if(y%4==0& &y%100!=0|| y%400==0); printf(“the above given year IS a leap year”); else printf(“the above given year IS not a leap year”); getch(); } 7. Individual Digits # include # include main( ) {int a,b,c,d; clrscr( ); printf ( “ Enter a two digit number :”);

Page 7 of 65

scanf (“ %d”, &a); b=a/10; c=a%10; d=b+c; printf (“sum of individual digits of given numbers id %”, d); getch( ); }

Page | 8

8. Program to accept a three digit number and print the sum of individual digits. # include # include main( ) {int a,b,c,n, sum; clrscr( ); printf (“ Enter a Three Digit Number:“); scanf (“%d”,&n); a=n/100; b=( (n%100)/10); c=n%10; sum=a+b+c; printf (“ Sum of Individual Digits of Given Numbers is %d”, Sum); getch( ); } 9. Program to accept a number and check the given number is Armstrong or not. # include # include main( ) {int n, a, b, c, d; clrscr( ); printf (“ Enter a Three Digit Number: “); scanf (“%d”, &n); a=n/100; b=((n/10)%10); c=n%10; d=a*a*a*+b*b*b +c*c*c; if (n= =d) printf (“The Given Number is Armstrong number”); else Page 8 of 65

printf (“The Given Number is Not Armstrong number”); getch( ); } 10. Program to print ODD numbers from 1 to 10 # include # include main( ) {int i; clrscr( ); for (i=1; i=1; i--) printf(“%d\n”,i); getch( ); }

12. Program to print sum of the natural numbers from 1 to 10. # include # include main( ) {int n,sum=0,i; clrscr( ); for (i=1; i
View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF