C Programs Quick Reference
INDEX
Notes | Simple Programs : | Index |
---|---|---|
Prgm001.c : | A Prgm to get user's name from keyboard & display. | |
Prgm002.c : |
Prgm to accept name, age & from user & display it in the following
format. Name: Age: Address: | |
Prgm003.c : | Prgm showing Multiple Level Functions. | |
Prgm004.c : | Prgm to find out Simple Interest. | |
Prgm005.c : | Prgm to find the distance. | |
Prgm006.c : | Prgm to calculate Area of a Rectangle. | |
Prgm007.c : | Prgm to calculate Square of a number. | |
Prgm008.c : | Prgm to accept name, marks for 5 subjects & calculate average & percentage. | |
Prgm009.c : | Prgm to accept Price & Quantity of a Product & calculate total amount. | |
Prgm024.c : | Prgm to calculate year of Service of an employee. | |
Prgm025.c : |
Prgm to calculate no. of weeks, Months & remaining days by accepting no. of days from user. | |
Prgm031.c : | Prgm To Convert temperature form Centigrade to Fahrenheit & Vice-versa. |
Notes | Programs based on "If, If-else & Nested If-else Statements" | Index |
---|---|---|
Prgm010.c : |
Calculate Total salary based on the following conditions if basic is above Rs. 10,000/- H.R.A is 10% & DA is 5% otherwise H.R.A is 15% & DA is 10%. | |
Prgm011.c : | A Prgm to check whether the Two numbers entered are equal or not. | |
Prgm012.c : | To check whether the entered number is divisible by 5 or not. | |
Prgm013.c : | To check whether the entered number is Even or Odd. | |
Prgm014.c : | To check whether the entered number is +ve or -ve. | |
Prgm015.c : | A Prgm to accept two numbers divide 1st by 2nd & display the remainder. | |
Prgm016.c : |
Prgm to accept name, marks for 5 subjects & calculate total & average Based on the average display the classes like distinction - First class - Second class - Pass - Fail. | |
Prgm017.c : | To check whether the entered character is Vowel or Consonant Also see 70 | |
Prgm018.c : | To find whether a year is Leap Or Not | |
Prgm019.c : |
Prgm to calculate selling price of a TV based on discount given under following
conditions a) If TV is B/W 5% discount b) If TV is color & screen size is 14" 8% discount c) If TV is color & screen size is 21" 10% discount | |
Prgm020.c : |
Calculate Total salary based on the following conditions Grade: A - H.R.A 45% - Grade: B - H.R.A 40% Grade: C - H.R.A 35% - Grade: D - H.R.A 30%. | |
Prgm021.c : | Prgm to find Largest of three numbers | |
Prgm027.c : | Converting from lower case to upper. also see 28, 41, 88 |
Notes | Programs based on Ternary Operator (Conditional Operator) | Index |
---|---|---|
Prgm022.c : | Prgm to check whether the entered number is Even or Odd. | |
Prgm023.c : | Prgm to find Largest of three numbers. | |
Prgm026.c : | Prgm to get ASCII value of a character. | |
Prgm028.c : | Converting from lower to upper case. | |
Prgm029.c : | Check whether the entered no. is greater than 100 or not. | |
Prgm030.c : | Check whether the entered no. is between 100 & 200. |
Notes | Programs based on While Loop | Index |
---|---|---|
Prgm032.c : | To display count down numbers from 10 to 1. | |
Prgm033.c : | Prgm to accept 10 no.s & find their sum. | |
Prgm034.c : | Prgm to accept name, address, marks in 5 subjects, calculate average. Repeat for 10 students. | |
Prgm035.c : | Prgm to find highest of 10 no.s. Also see 51,93 | |
Prgm036.c : | Calculate Simple interest for 3sets of p.t,r. | |
Prgm037.c : | Function to accept name & display it ten times. | |
Prgm038.c : | Accept 10 no.s, find how many of them are divisible by 5. | |
Prgm039.c : | Accept 10 no.s, display total no of odd & even no.s. | |
Prgm040.c : | Prgm to display square of a no. from 1 to 100. | |
Prgm041.c : | Prgm to convert lower case to uppercase. Repeat till user presses '#' key. Also see 27, 28, 88 | |
Prgm042.c : | Accept 10 no.s & calculate their average. | |
Prgm043.c : | Prgm to find Factorial of a Number. Also see 61, 72 | |
Prgm044.c : | Prgm to generate Fibonacci Series. | |
Prgm045a.c : | Prgm for reversing a no. | |
Prgm045b.c : | Prgm for reversing a no. |
Notes | Programs based on For loop & Nested For Loop | Index |
---|---|---|
Prgm046.c : | Prgm to display from 1 to 10. | |
Prgm047.c : | Prgm to countdown from 10 to 1. | |
Prgm048.c : | Accept name & display thrice. | |
Prgm049.c : | Accept name & Address three times. | |
Prgm050.c : | Accept 10 no.s & calculate total. | |
Prgm051.c : | Accept 10 no.s & find the maximum of them. Also see 35, 93 | |
Prgm052.c : | Calculate SI for 3 sets of p,t,r. | |
Prgm053.c : | Prgm to accept name, address, marks in 6 subjects, for 10 students & calculate average. | |
Prgm054.c : |
Prgm to accept name, address, marks in 6 subjects, for 10 students. calculate average & display the classes like distinction - First class - Second class - Pass - Fail. | |
Prgm055.c : | Prgm to print all pairs of no.s (bet 1 to 10) whose sum is 10. | |
Prgm056.c : |
Prgm to
display * as shown. Also see
77 to 82 ***** **** *** ** * | |
Prgm057.c : |
Prgm to display * as shown * ** *** **** ***** | |
Prgm058a.c : |
Prgm to display as shown 1 22 333 4444 55555 | |
Prgm058b.c : |
Prgm to display as shown 1 12 123 1234 12345 | |
Prgm059.c : |
Prgm to print A to Z & a to z. like: A a B b C c D d .. .. .. .. .. .. .. .. Y y Z z | |
Prgm060.c : |
Prgm to print ASCII values of characters from A to Z like A = 65 B = 66 etc... | |
Prgm061.c : | Prgm to find factorial of a no. | |
Prgm062.c : | Prgm to display table of 5. | |
Prgm063.c : | Prgm to accept a no. & display table for it. | |
Prgm064a.c : |
Prgm to give the print the series as shown 1, 2, 4, 7, 11, 16, 22, 29...... | |
Prgm064b.c : |
Prgm to give the print the series as shown 1, 2, 4, 7, 11, 16, 22, 29...... |
Notes | Programs based on Do - While Loop | Index |
---|---|---|
Prgm065.c : | Prgm to generate Fibonacci Series till 999. | |
Prgm066.c : | Accept a character display ASCII value of that character. Repeat till user enters Q or q | |
Prgm067.c : | Prgm to check whether the entered no. is palindrome or not. |
Notes | Programs based on Switch Case statement | Index |
---|---|---|
Prgm070.c : | Check whether entered character is Vowel or not. also see 17 | |
Prgm070a.c : | Count the no. of Vowels & Consonants. | |
Prgm071.c : |
Prgm to display as shown & perform the respective operation mentioned in the
menu. 1) Addition 2)Subtraction 3)Multiplication 4)Division Enter Your Choice | |
Prgm072.c : |
Prgm to display as shown & perform the respective operation mentioned in the
menu. Enter Your Choice 1) Even or Odd 2) Factorial 3) Fibonacci 4) Prime Number | |
Prgm073.c : | Prgm to accept week no.s from 1 to 7 & display corresponding week name. | |
Prgm074.c : | Prgm to accept Month no.s from 1 to 12 & display corresponding month name. | |
Prgm075.c : |
Calculate Salary based on Grade. Accept name, salary &grade from user. Grade A - 20% H.R.A Grade B - 15% H.R.A Grade C - 10% H.R.A Grade D - 5% H.R.A | |
Prgm076.c : |
Prgm to display as shown & perform the respective operation mentioned in the
menu. Enter Your Choice 1) Reverse a number 2) Check if a no. is Palindrome |
Notes | Programs based on Arrays | Index |
---|---|---|
Prgm083a.c : | Initializing an array. | |
Prgm083b.c : | Initializing an array the other way. | |
Prgm084.c : | Storing to an array & printing contents from an array. | |
Prgm085.c : | Accept 10 no.s until zero is entered & display the total no of no.s &their sum | |
Prgm086.c : | Find the length of an array. | |
Prgm087.c : | Change the contents stored in an array. (not written) | |
Prgm088.c : | Prgm for converting a character string from upper to lower case & vice-versa. see 27, 28, 41 | |
Prgm089.c : | Prgm for reversing a string. | |
Prgm090.c : | Compare two strings & display whether they are equal. | |
Prgm091.c : | Function which stores alphabets from A to Z in an array, by applying ASCII codes. | |
Prgm092.c : | Compare two strings & display the largest of them. | |
Prgm093.c : | Accept 10 no.s & display the highest & lowest along with all no.s. Also see 35, 51. | |
Prgm094.c : | Prgm to count no. of words in a long string. | |
Prgm095.c : | Prgm to extract a sub string from a specified position containing a specified no. of characters form input string. | |
Prgm096.c : | Prgm to Assign the contents of array-1 to array-2 & display from second array. | |
Prgm097.c : | Program to accept two string join second string to first string (CONCATENATION). | |
Prgm098.c : | Progm to check whether the given string is Palindrome or not. | |
Prgm099.c : | Accept 10 no.s display their sum & result. | |
Prgm100.c : | Prgm to find the largest element in an array & find position of its occurrence. | |
Prgm116.c : | Accept Name from the user & display as in prgm081.c | |
Prgm117.c : |
Program to display as shown (MAGIC Triangle) 1 2 3 2 3 4 5 4 3 4 5 6 7 6 5 4 5 6 7 8 9 8 7 6 5. | |
Two Dimensional Arrays & Multidimensional Arrays | ||
Prgm107.c : | Program to accept elements into a 3x3 matrix & display in matrix form. | |
Prgm108.c : | Program to accept size of 2D array & accept elements into that matrix & display in matrix form. | |
Prgm109.c : | Progrm to print Multiplication Table from 1 to 10. | |
Prgm110.c : | Program to accept size of 2D array & find the sum of Column elements & Row elements. | |
Prgm111.c : | Program to find Trace & Transpose of a Square Matrix. | |
Prgm112.c : |
Program using 2D array to find & print the following. a) Total value of sales by each Salesman. b) Total value of each item sold. c)Grand Total of sales of all items by all salesmen. | |
Prgm113.c : | Addition of matrices. | |
Prgm114.c : | Matrix Multiplication. | |
Prgm115.c : | Program for rotation of matrix by 90� | |
Prgm118.c : | Program to declare 5 subjects of 20 columns. The list of student names & subjects are stored in 2D character array called student & subject respectively. The marks are stored in an integer array called marks. Let maximum no. of students be 30. | |
Prgm119.c : | Program to calculate class average across students in each subject. | |
Prgm120.c : |
Assume that the data exists in the array & average has been calculated, WAP
which will allow the user to query on the array to a) Display student names along with his average marks. b) Display each subject along with class average. c) Display list of students & subjects. Allow user to choose one from each based on the no. chosen, display appropriate marks. d) Check the average of each student where ever average exceeds 80, Display student name & subject name & marks in each subject. |
Notes | General Programs | Index |
---|---|---|
Prgm068.c : | Program to find LCM & GCD of the two no.s entered. | |
Prgm069.c : | Prgm to check whether enterd no. is prime or not. | |
Prgm077.c : |
Prgm to
display * as shown (also see 78 to 82 &
56 to 58b) * * * * * * * * * * * * * * * | |
Prgm078.c : |
Prgm to display * as shown * ** *** **** ***** | |
Prgm079.c : | Accept no of rows from user & display it as in prgm077 | |
Prgm080.c : |
Prgm to display "PABHATCP" as shown P PA PAB PABH PABHA PABHAT PABHATC PABHATCP | |
Prgm081.c : |
Prgm to display "PABHATCP" as shown P PA PAB PABH PABHA PABHAT PABHAtC PABHATCP | |
Prgm082.c : |
Prgm to display "PABHATCP" as shown P P PA PA PAB PAB PABH PABH PABHA PABHA PABHAT PABHAT PABHATC PABHATC PABHATCP PABHATCP |
Notes | Searching & Sorting | Index |
---|---|---|
Prgm101.c : | Linear Search. | |
Prgm102.c : | Binary Search. | |
Prgm103.c : | Selection Sort or Exchange Sort. | |
Prgm104.c : | Insertion Sort. | |
Prgm105.c : | Bubble Sort. | |
Prgm106.c : | MergeSort. (Not written) |