-
Notifications
You must be signed in to change notification settings - Fork 2
/
List of C Programming Questions.txt
564 lines (381 loc) · 10.6 KB
/
List of C Programming Questions.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
1. Program to print "Hello World!!".
2. Program to assign values of two numbers and print their addition.
3. Program to accept values of two numbers and print their addition.
4. Program to print simple interest.
5. Program to accept value of radius and print area of a circle.
6. Program to accept a number from user and print it’s square & cube.
7. Program to accept two values of a & b and swap their values.
8. Program to accept two number and print largest among them.
9. Program to accept a number and check whether the number is Positive, Negative or Zero.
10. Program to check whether the number is even or odd.
11. Program to accept three numbers from user and print them in ascending and decending order.
12. Program to find the roots of a quadratic equation.
13. Program to accept rollnumber and marks of three subjects from user and print total marks, average and grade.
14. Program to print numbers from 1 to n using while loop.
15. Program to print numbers from n to 1 using Do While loop.
16. Program to print first n even numbers.
17. Program to accept a number and print that number in reverse order.
Ex:- 1024
Output:- 4201
18. Program to accept a number and print sum of it’s digits.
19. Program to take a number from user and check whether it is Armstrong number or not.
20. Program to take number from user and print table of that number.
21. Pattern 1
•
• •
• • •
• • • •
• • • • •
22. Pattern 2
• • • • •
• • • •
• • •
• •
•
23. Pattern 3
•
• •
• • •
• • • •
• • • • •
24. Pattern 4
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
25. Pattern 5
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
26. Pattern 6
A
B C
D E F
G H I J
K L M N O
27. Pattern 7
1
1 2 1
1 2 3 2 1
1 2 3 4 3 2 1
1 2 3 4 5 4 3 2 1
28. Pattern 8 (Binary Pattern)
1
0 1
1 0 1
0 1 0 1
1 0 1 0 1
29. Pattern 9
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
30. Pattern 10
1
2 1
3 2 1
4 3 2 1
5 4 3 2 1
31. Pattern 11
1 1
1 2 2 1
1 2 3 3 2 1
1 2 3 4 4 3 2 1
32. Floyd's triangle
1
2 3
4 5 6
7 8 9 10
11 12 13 14
33. Pyramid
*
* *
* * *
* * * *
* * * * *
34. Pyramid 2
*
*A*
*A*A*
*A*A*A*
*A*A*A*A*
35. Number Pyramid
1
232
34543
4567654
567898765
36. Pascal triangle
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
37. Pascal triangle without using function
1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
38. Pascal triangle 2
1
121
12321
1234321
123454321
39. Number Alphabet Pattern
1
A B
2 3 4
C D E F
5 6 7 8 9
G H I J K L
40. Number Diamond Pattern
1
1 2 3
1 2 3 4 5
1 2 3 4 5 6 7
1 2 3 4 5 6 7 8 9
1 2 3 4 5 6 7
1 2 3 4 5
1 2 3
1
41. Diamond of Numbers
1
2 2 2
3 3 3 3 3
4 4 4 4 4 4 4
5 5 5 5 5 5 5 5 5
4 4 4 4 4 4 4
3 3 3 3 3
2 2 2
1
42. Diamond Pattern
•
•••
•••••
•••
•
43. Diamond star outline
*
* *
* *
* *
* *
* *
*
44. Hollow Diamond
* * * * * * * *
* * * * * *
* * * *
* *
* * * *
* * * * * *
* * * * * * * *
45. Hollow Square
* * * * *
* *
* *
* *
* * * * *
46. Hourglass Pattern
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
* * *
* * * * *
* * * * * * *
* * * * * * * * *
47. Nested Star-Hash Pyramid
#####*#####
####*#*####
###*###*###
##*#####*##
#*#######*#
*#########*
48. Reverse star pyramid
* * * * * * * * *
* * * * * * *
* * * * *
* * *
*
49. Rhombus Pattern
1 1
2 2
3 3
4 4
5 5
4 4
3 3
2 2
1 1
50. Square kite pattern
1
2 2
3 3
4 4
3 3
2 2
1
51. Triangle with only border
*
* *
* *
* *
* *
* *
* * * * * * *
52. Program to accept number and print it's factorial.
53. Program to accept number and print if it is prime number or not.
54. Program to print 'n' prime numbers.
55. Program to accept a number and print Fibonacci sequence.
56. Add 'n' numbers
57. Add 'n' numbers using array.
58. Program to accept a number and add the digits of that number.
59. Program to accept a number and add the digits of that number using recursion.
60. Average of numbers.
61. Program to calculate Square of 'n' numbers.
62. Program to take an alphabet from user and check whether it is a vowel or not.
63. Program to take two numbers and check whether they are amicable numbers or not.
64. Program to accept a number and print the factors of that number.
65. Program to accept two integer numbers and print the GCD(Greatest Common Divisor).
66. Program to find power of number.
67. Program to calculate HCF & LCM.
68. Program to find largest among 3 numbers using ternary operator.
69. Program to find largest number of 'n' numbers.
70. Program to check whether the number is neon number or not.
71. Program to check Niven number (Harshad number).
72. Program to check whether the number is palindrome or not.
73. Program to check perfect number.
74. Program to find the square root of a number.
75. Program to print sum of 'n' prime numbers.
76. Program to print sum of factorial series 1/1! + 2/2! +...1/N!
77. Program to calculate the sum of 'n' terms in Taylor series.
78. Program to swap two numbers without using third variable.
79. Program to swap two numbers using bitwise XOR.
80. Program to swap two numbers using pointer.
81. Program to add two numbers using pointer.
82. Program to add first and last digit of a number.
83. Program to find area of triangle using Heron's formula.
84. Program to convert Binary to Decimal.
85. Program to convert Decimal numbers to Binary.
86. Program to find f(x) by Lagrange's interpolation method.
87. Program to check the leap year.
88. Program to find nCr & nPr.
89. Program for Newton Raphson General.
90. Program to calculate the sum of even numbers from 1 to n.
91. Simpson 1/3 rule.
92. Program to add two strings without using concat() function.
93. Program to check vowels in string.
94. Program to compare two strings.
95. Program to compare strings without using strcmp() function.
96. Program to convert string from uppercase to lowercase.
97. Program to copy char array / copy string.
98. Program to copy string without using strcpy() function.
99. Program to count frequency of characters in a string.
100. Program to count total number of uppercase and lowercase in a string.
101. Program to calculate the length of string.
102. Program to calculate the length of string without using strlen() function.
103. Program to check the palindrome of string.
104. Program to check the palindrome of word using array.
105. Program to remove white space in string.
106. Program to reverse the string.
107. Program to reverse the string using pointer.
108. Program to sort the strings.
109. Program to swap two strings.
110. Program to add two matrix.
111. Program to arrange array numbers in ascending order.
112. Program to check whether the matrix is sparse matrix or not.
113. Program to delete an element from array.
114. Program to delete given number from array.
115. Program to calculate the determinant of 2×2 matrix.
116. Program to calculate the determinant of 3×3 matrix.
117. Program to find Largest and Smallest number in array.
118. Program to reverse the array.
119. Program to insert an element in array.
120. Program to sort array using Insertion sort
121. Binary Search
122. Multiplication of two Matrices
123. Goldbach's Conjecture
124. Numerical Spiral Pattern.
1 2 3 4 5
16 17 18 19 6
15 24 25 20 7
14 23 22 21 8
13 12 11 10 9
125. Program to sort array using Selection Sort.
126. Program to sort array using Bubble Sort.
127. Program for infix to postfix conversion.
128. Pattern
1
3 2
4 5 6
10 9 8 7
11 12 13 14 15
21 20 19 18 17 16
129. Pattern
1
8 2
14 9 3
19 15 10 4
23 20 16 11 5
26 24 21 17 12 6
28 27 25 22 18 13 7
130. Swastika pattern.
* * * * *
* *
* *
* * * * * * *
* *
* *
* * * * *
131. Pattern
5 5
54 45
543 345
5432 2345
543212345
5432 2345
543 345
54 45
5 5
132. Pattern
@ @
@ @ @ @
@ @ @
@ @ @
@ @ @ @
@ @ @ @ @
@ @ @
@ @ @ @ @
@ @ @ @
@ @ @
@ @ @
@ @ @ @
@ @
133. Program for creating and displaying a linked list.
134. Program to delete a node for a given element from linked list.
135. Sieve of Eratosthenes : An algorithm to generate all the prime numbers within an range.
136. Binary search using recursion
137. Program to check whether the number is palindrome or not using recursion.
138. Program to split words from a string using strtok function.
139. Program to read multiline string using scanf.
140. Program to find day on a particular date
141. WAP to multiply and add two complex numbers
Input :
5
-4
4
6
Output :
Sum is 9 + 2i
Product is 44 + 14i
142. Program to concatenate two strings using pointer.
143. Program to allocate memory using malloc() and free memory using free().
144. Circular Link List.