[go: up one dir, main page]

0% found this document useful (0 votes)
57 views9 pages

C Lab Excercise CDAC

The document outlines a series of programming exercises in C, covering various topics such as input/output statements, mathematical operations, conditional statements, loops, arrays, pointers, and user-defined functions. Each exercise includes specific tasks like calculating areas, verifying formulas, and implementing control structures. The exercises are designed to enhance programming skills and understanding of C language concepts.

Uploaded by

chotaimanav46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
57 views9 pages

C Lab Excercise CDAC

The document outlines a series of programming exercises in C, covering various topics such as input/output statements, mathematical operations, conditional statements, loops, arrays, pointers, and user-defined functions. Each exercise includes specific tasks like calculating areas, verifying formulas, and implementing control structures. The exercises are designed to enhance programming skills and understanding of C language concepts.

Uploaded by

chotaimanav46
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
C-Lab Exercise Printf () Statement 4. Print C Programming" 2. Print Your Name On screen, 3, Print Address on screen, ‘Scanf() statement Enter the value of an integer variable and print it on screen. Print value of | and check iis less, equal or greater than zero. Input two numbers and prints its square and cube. Input two numbers and prints its Addition, Subtraction, Multiplication, and Division. Verity the formula I=(c+d)"(g+h) Verify the formula x=((k-4)"(a"4)) 100 10. Verify he formula s=((4"a+c)-2°a"v)/100 41. Verify the formula a=p*(1+(e/100)n)-p 412. Verify the formula t=((v+s)+(-m)") 18, Calculate the area of circle. 14, Calculate the area of Triangle. 18, Verify the formula c=(a+b)"(a+b) 46. Write a program to count the simple interest 17. Input a Rupees and prints its value converted into Dalla 18. Input a Number of Chairs and its Total Cost and Prints the Cost of Each chai Else statement 48. Enter value and check its less, equal or greater than zero. 20. Input 2 number and print the maximum among them, 21, Input 2 number and print the maximum among them. (with conditional operator) 22, Input 2 number and print the minimum among them, 23. Input 2 number and print the minimum among them, (with conditional operator) 24, Input 3 number and print the maximum among them 25. Input 3 number and print the maximum among them. (with conditional operator) 26. Write a program that find minimum and maximum out of 3 values. 27. Write a program that interchange or swap the values of 2 variables. 28. Write a program to interchange the value of 2 variable without using 3rd variable 29. Write a program to check whether the entered no is add or even, 30. Get a character in lower case form user and display it in upper case. 431. Get a character from user and print tell that is it vawel or consonant. 32, Print & calculate area of circle, area of triangle & (f+g)"(t+g) & simple interest & exit in one program, 33, Print & calculate addition, substrection, multiplication & division of two value in one progarm using if statement 34, Write a program that take input of § subjects marks. Count the percentage, Print the result {or following condition If student has 70% or more then 70% then DISTINCTION. If student has percentage between 60 and 69 then FIRST CLASS. It student has percentage between 50 and 59 then SECOND CLASS. If student has percentage between 40 and 49 then PASS CLASS. It student has percentage less then 40 then FAIL. 35. Write a program that take input of 5 subjects marks. if student get 40 or more then 40 then he is PASS in that subject otherwise FAIL print the result for folowing condition, I student is pass in all subjects then declare PASS. Is student i fail in 1 or 2 subject then declare ATKT. If student is fail in more then 2 subject then declare FAIL. 36, Write a program that count the area for circle, square, rectangle and triangle using Switch- Case control structure 37, Write a program that take input of year in 4 digit, Determine whether the year is leap year (oF not (ry 0 solve this problem with && and or operator) © seamed wen OK Scmner 38. Wiite a program that determine the grade of steel according to following condition. + Hardness must be greater then 50 2 Garton must be less then 0.7 3. Tensile must be greater then 5500 ‘Take the input for above qualities through keyboard from user Grades are decided as follows. Grade A if a3 conditions are met. Grade B if condition (1) and (2) are met Grade C if condition (2) and (3) are met. Grade it condition (1) and (3) are met. Grade E if only one condition met. Grade F ifnone of conditions are met. 38, Wiite a program to find maximum from 3 values using conditional operator. 40. Write a program that generate same output as of program no (10) using break statement, 41, _ Write a program that performs the sum of given numbers until user says no using Go-To statement, 42, Wiite a sample program that demonstrate the use of Continue statement. Looping structure (while, do...while, for) 43, Print 1 to 10. 44, Print 2.4.6,8.10, 45. Print 13.5.7, 46. Print 1.2.4,8,16,32,64, 47. Print 1010 1 48, Print 110.2,9.3,8.4,7.56, 48. Print 211,20,28 25 41,46,50,53,55 56. 50. Print first 100 even numbers. 51 Print first 100 odd numbers, 52. Print frst 50 natural numbers, 153. Print the fotal oft to 50. ‘54, Print the total of 1/2+2/3+...+9/10, 55, Print the total of 1-2+3-4+5-6+7-8+9-10, 56. Print the total of fist 100 even numbers. 57, Print the total of first 100 odd numbers. 58, 0.1+0,02+0.003+0,0004+0 000005, 59, Except one no from user and display Reverse of it 60. Except one no from user and display sum ofits digits 61. Except one no from user and display its factorial. 62, Except one no from user and find if tis prime or not. 63. Except one no from user and find if itis Armstrong oF not. 64, Print 1 12.358 1321 34 55 ... (Fibonanci series) 65. Generale the value of nl factorial for n number 66. 1+2+3+4+5+6 up to terms 67, 1#3+5+7+9 up ton terms 68. 1+2+4+5+7+8 up ton terms 69, _Wite a program that perform the folowing output for n by n matrix without using array 12345 70.9 876 141213 1415 20191817 16 21.2223 24 25 70, X+X2*X3+X4+X5 upto mterms Th. XIV X2V2+X3/¥3 upton tems 72. XIV + X2NV+ X2Iv2 + XB/¥2 + XSIYS up ton terms 73. AYAR*AR2+ARStARG up to n terms 74, 4142143144145! Upton terms 75. 11+31+51+71 Upton terms 76. X +X3-+XS +X7 upton terms 77 XI + X2s22 + X3I33 + XAl4d up to nterms 78. AB*CD+A2B2+C202 up to n terms 78. Wiite a program to generate fibona series 0,1,1,2,3.5.8,13 up to n terms. 80. 173+ (142)" 32 + (14203) * 33+ (14243+4) 34 Up to n terms © seamed wen OK Scmner 81, 112! + 3141+ 516! Up tonterms 82. XIN - 3/3) + XBI51 -X7/7! Upton terms 3, Write a program to calculate the sum of add and even number between given no of series. (Perform all the exercises from 62 to 73 in following 3 patterns) Pattorn-| Pattornell Pattern Nested looping structure. £84, Print patter lke follow, 12345 12345 12345 12345 12345 85. Print pattern lke follow. ni1 22222 33303 44aaq 55555 86, Print pattem lke follow. 12345 246 8 10 369 1215 48 1216 20 5 1015 2025 87, Print patter lke follow. AABAA BBB BB cecce DDDDD EEE EE £88, Print patter lke follow. 1 2 333 44444 555555 89, Print pattern lke follow. 1 2 123 1234 12345 80, Print patter lke follow, 5 54 543 5432 54321 81. Print pattern lke follow. © seamed wen OK Scmner 92, 93, 94, 96. 96. 97, 98, 99, 100. 1 2 321 4321 54321 Print pattem lke follow. 1 23 456 78910 1112181415, Print patter lke follow. 1 10 100 1000 ‘10000 Print pattem lke follow. 1 on o10 1010 10101 Print patter lke follow, 1 10 101 1010 10101 Print patter lke follow. bo ‘dda Print patter lke follow. be det ghij kimno Print patter lke follow. yx tsrq ponml Print pattem lke follow. 5 45 345 2345 12345 Print patter lke follow. 12345 1234 123 © seamed wen OK Scmner 101. 102. 103. 108, 110. 11 Print pattern tke follow. 12345 2468 369 48 Print pattern tke follow. 54921 5432 543 54 Print pattern tke follow. 54921 4321 324 2 1 104, Print pattern tke follow. 12345 2345 345 45 5 108. Print pattern tke follow. 55555 4484 333 2 1 106. Print pattern tke follow. 246810 468 10 6810 810 10 107. Print pattern tke follow. abcde bode cde de e 108. Write a program that perform the following output for n rows 1 3 56 8 910 ‘Write a program that perform the following output for n rows ‘Write a program that perform the following output for n rows 1 12 1 253 10203 4 ‘Write @ program to perform the following output for n rows © seamed wen OK Scmner 112, 113, 114 1 104 10101 Write a program to perform the following output for n rows ue pe ae Be ora on ‘Write a program that perform the following output for n rows. 123454321 1234 4321 123° 321 12 21 1 1 Write @ program for following output for n no of rows( Pascal triangle) 1 1 1 1 2 1 1 3 3a 1 1 4 6 4 1 Array & Pointer 115, 116. 417 118 119. 120. 121 122 123, ‘Accept § numbers in an array and display it ‘Accept 10 numbers in an array, sortit and display i ‘Accept 4 numbers in 2-d array, ‘Accept 9 numbers in form of matrix. (3 X 3 matrix) ‘Accept 10 numbers in an array and store it in another array, ‘Accept 10 numbers in an array and find total of positive and negative no, ‘Accept § numbers in an array and find maximum and minimum value. ‘Accept 5 numbers in an array and calculate average of it ‘Accept values in 3X 4 array and find out row total, column total, maximum, minimum ‘and total, 124. 125, 126. 127 128. 128, 130. 131 132 133 134 136. 136 137. Greate a program that shows concept of pointer. Create a program to swap two values (Pass by reference) Create a program to accept 10 numbers in an array and sort it wth the help of pointer, ‘Wite a program that find maximum and its position from 10 number using array. Write @ program that sort the value in ascending order in array. ‘Write @ program that generate the array of distinct or unique values from the array given by ‘Write a program that calculates the total marks and percentage for 5 subject marks using array. Write a program that arrange the array values in reverse order. Write a program that perform the summation and subtraction of two matrices. Write a Program that perform the sum of rows and sum of column for n by n matrix Write @ Program that perform the sum of rows and sum of colurnn for m by n matric Write a program that take the input of sales of 5 salesman for 4 different quarter of year, Count the total sales perform by each salesman and sales performed during each quarter also perform the grand total sales. Write @ program that perform the sum of diagonal elements of n by n matrix Write a program of spiral matrix using 2-D matric Built in functions 138, 130. 140. 141 142 143, 144, ‘Accept one no and display its absolute valve. ‘Accept one no and display its log ‘Accept one no and display its square root. Get 2 no from user and display base*exp. (2*3=8) Get a string from user and display length ofthat string, Get a string from user and copy itn another variable, Get two strings from user and compare weather both are same or not © seamed wen OK Scmner 148. 148 147 148 Get a string from user and display reverse afi. Get two strings from user and merge it into first string Get a string from user and display it in lower case. Get a string from user and display itn upper case User Define Function 149, 150 51 182 183 184 156. 186. 187. 188, 170. 171. 172 173 174 175: Create a user define function named sum which accept 2 arguments (of integer type) and return the sum of them, Create a user define function named avg which pass array as argument (of integer type) and return its average value. Create a user define function named evenodd which accept one argument (of integer type) and relurn ifthe number is even or odd Create a user define function named fact which accept one argument (of integer type) and return the factorial of given number. Create a user define function named prime which accept one argument (of integer type) and display thatthe no is prime or not. (no need to retum value) Create a user define function named triangle which accept one argument (af integer type) and display a triangle like, (if you have given 4 as argument) 1 12 123 1234 Create a user define function named power which accept two arguments (of integer type) () base (i) expon and display the base*expon value. Create a user define function named Sroot which accept one argument (of integer type) and display the square root ofthat no. Create a user define function named ASCII which accept one argument (of character type) and display ASCII value of that character Create a user define function named CHR which accept one argument (of integer type) and display character of that ASCII value. rite a function to count the simple interest. Write a function that count compound interest \Write a function to generate the square of any given number Write @ function which should work as a power function Write a functions to count the area of cre, triangle, rectangle and square Write @ function to print any character forn no of ime. Write a function which should work as absolut function. \ite a program witch demonstrate the use of pre and post increment and decrement ‘operator also define the use of assignment operator like +=, = = , f= Write a functions which should work ike aisnum) salpha().\schar() functions Write a functions which should work tke 1) asc() function which returns an integer value of siven character(2) chard) function which returns character value for given integer value Write a function to interchange the two value a and b (Call By Reference) witch passes the 2 arguments in form of address of @ and b variable with declaration ike Void swaptint * int Write a void function which count the area and perimeter of ctcle(Call By Reference) witch passes radius , address of area variable and address of perimeter variable with {declaration lke Void count(feat , float *, float *) ‘Write a function to count mean for discrete data, User has to pass only n no of values and address of first element of an array with declaration like float meanvint “oat *) Write a function ta find out maximum from of n no of values. User has to pass n no of elements and Address of first variable in an array. With declaration ike int findmaxiint int *). \Write a function to arrange integer values in ascending order in an array witch passes n of elements and address of first element of an array with declaration ike void arrange(intint 4 Write a program that demonstrate the use of gets() and puts() Write a program that demonstrate the use of stromp(),stren(), stropy(, strev(), strupr(), sirwr() and streat() builtin function. © seamed wen OK Scmner 176. Write a program that take input of name of 10 students. with gets() and just print them with puts) function, 177. Write a program or function which should work lke a strlen( function, 178. Write a program or function which should work lke a strcmp) function, 178. Write a program or function which should work lke a strcpy() function, 180. Write a program or function which should work lke a strcat() function, 181. Write a program or function which should work lke a strrev() function, 482. Write a program or function which should work lke a strupr() function. 183. Write a program of function which should work lke a strwr() function. 184. Write a program that take input names of 10 students. Arrange them in ascending order in string array, 185. White a program that take input paragraph of 10 lines. Count total no of word and total no of characters (Excluding blank spaces). 186. Write a pre-processor directives which returns (1) area of circle (2) perimeter of circle 187. Write a pre-processor directives which checks works like a (1) isdigit() (2) isalpha() functions. 188. Write a preprocessor directives which demonstrate the use of #ildef and dindet 188. Write a preprocessor directives which use some symbolic directives for (88. operators, Structure 180. Create a structure named student that have member variable roll no, name, mt, m2, m3, ‘sum, average, and grade. Program ask for rall no, name, m1, m2, m3 and calculate sum, average and grade 191. Create a structure named EMP that have member variables employee no, employee name, basic salary. DA, HRA. TA , PF and Gross Salary. 492. In above siructure create an array of structure. 183. In above structure create an array of structure and use pointer. 44. White a program to find size of structure. 495. White a simple program using structure that demonstrate different type of declaration of structure variable 196. Write a program using structure that accept rolino,name and percentage of students. 197. White a program that demonstrate the use of aray of structure variable 188. Write a program that demonstrate how one structure variable can be copied into another 398. White a program that demonstrate the use of structure and function. 200. Write a program that access the structure variable using pointer. 201. Write a program that demonstrate the use of nested structure. For example to 202. struct marks struct student { int st introline: int 82 ‘char name|20}; int s3 struct mark mt int tota; jst: d 203. Write a program that demonstrate the use of getch() getche(),getchar() and putchar() functions, 204. Write a program that demonstrate the use of formatted input with (%{_]) operator. 205. Write a program that demonstrate the use of formatted output lke print("% 10d", ollno): printf("%10.2" salary) and printf" °s" 10,5.name) 206. Write a simple program that explain the precedence (priority) and associatively File Handling 207. Write a programme to create a fie, 208. Write a programme to read a fie. 209. Write a programme to copy one fle to another fle, 210. Write a programme to add dala into an existing fie, 211. Create a database for a person, which includes information lke person id, person name, ‘age, phone no, height, Give the faciity to add the data, read the data & person id should not be duplicate 212. Write a program to accept fle name form command line argument and write data into it © seamed wen OK Scmner 213, 214, 215. 216. Write a program which accept tw file name form command line argument arg! and arg2, ‘copy the content of argt to arg2 Write a program to understand the use of gete(), pute) Write @ program to understand the use of getch(), putch0. Write a program to understand the use feof), fgetc), fgets), fpute), fputs(), tread), write), fell and fseek0). © seamed wen OK Scmner

You might also like