You are on page 1of 8

LIST OF SAMPLE PROGRAMS

NOTE:
Remember these questions should not be considered only syllabus for the competition. These are
the examples or sample data to give concept and train the students. Test data may or may not
include these samples.
LIST OF PROGRAM IS AS GIVEN:

Page 1 of 8
1. Print Number of Inputs taken from Keyboard using scanf() in C Program unless user
presses ESC key
2. Write a program to find sum of digits in the number. (Without using array)
3. Write a program to find sum of ASCII values against characters in a string of max 10
characters (without using Arrays) entered by the user through keyboard. (no need of using
array)
4. Write a program to input a string (without using Arrays) in a single loop and calculate
A. Total number of characters
B. Total number of white spaces
C. Total number of vowels
D. Toggle the case form upper to lower and lower to upper for each character
E. Total number of full stops

5. Draw patterns of ALLAH, MUHAMMAD (PBUH), SUBHAN ALLAH, ALLAH


AKBAR, and such other different shapes as HUT, PGC, Complete English Alphabet Set
(uppercase, Lowercase) on the screen, Urdu Alphabets, Cap, open or close book and many
similar patterns using logical operator(&&(AND) ||(OR)) and if statement in nested
loops.
(Specific pattern will be provided in printed form).

6. Write a program to print maximum value of an unsigned integer in C


7. Solved series are:
A. 1+2+3+4+..N<
B. 1^2+2^2+3^2+4^2+..N^2
C. 1/1! + 2/2! + 3/3! + 4/4! + ... N/N!
D. 1+ 1/2 + 1/3 + 1/4 + 1/5 + .. 1/N
E. 1 + 3^2/3^3 + 5^2/5^3 + 7^2/7^3 + ... till N terms
8. Print all PRIME numbers from 1 to N using function C program
9. Print all Armstrong Numbers from 1 to N using C program. Such as Armstrong numbers
below 1000 are 1,153,370,371,407,
10. Find HCF (Highest Common Factor) or LCM (Least Common Multiple) program in c
11. Multiplication of two numbers using plus (+) operator
12. Write a program to read Formatted Time (in HH:MM:SS format) through Scanf().
13. Write a program to store into memory or Print value on the screen in Decimal, Octal and
Hex using printf().
14. Write a program to Print Number of Inputs taken from Keyboard using Scanf() in C
Program without using array.
15. Write down the code for Pyramid, Star Series and Patterns Programs using loops in C
language.
16. Write a Program using switch statement to find number of days in a month.
17. Write a C program to print all leap years from 1 to N.
18. Write a C program to print all upper case and lower case alphabets.
19. Write down the code to draw following diamond shapes using loops.

Page 2 of 8
* *****
** ****
*** ***
**** **
***** *
*
**
* ****
** ******
*** ********
**** **********
***** **********
********
******
****
**
*
0
********** 01
**** **** 010
*** *** 0101
** ** 01010
* *
0 0 12345
01 01 1234
010 010 123
0101 0101 12
0101001010 1
1 1 1
123 12 21
12345 123 321
1234567 1234 4321
123456789 1234554321
123454321 A
1234321 BC
12321 DEF
121 GHIJ
1 KLMNO
A ABCDEDCBA
BC ABCD DCBA
DEF ABC CBA
GHIJ AB BA
KLMNO A A

Page 3 of 8
A 1A2B3C4D5E
BAB 1A2B3C4D
CBABC 1A2B3C
DCBABCD 1A2B
EDCBABCDE 1A
A Enter number of rows: 5
ABA 1
ABCBA 23
ABCDCBA 456
ABCDEDCBA 7 8 9 10
11 12 13 14 15

Enter number of rows: 5 Output


0 1
101 22
21012 333
3210123 4444
432101234 55555
54321012345

12345
12345 2345
1234 345
123 45
12 5
1

54321 54321
4321 5432
321 543
21 54
1 5
1 5
22 44
333 333
4444 2222
55555 11111
55555 11111
4444 2222
333 333
22 44
1 5
12345
1234567
4321
12345
123
123
21
1
1

Page 4 of 8
13579
1
3579
01
579
101
79
0101
9
1 55555
24 45555
135 34555
2468 23455
13579 12345
1
1
10
23
101
456
1010
78910
10101
1
1
26
123
3 7 10
12345
4 8 11 13
1234567
5 9 12 14 15
12344321
1
123**321
234
12****21
56789
1******1
1 2 3 4 5 6 7 8 9 10 0
36 37 38 39 40 41 42 43 44 11 909
35 64 65 66 67 68 69 70 45 12 89098
34 63 84 85 86 87 88 71 46 13 7890987
33 62 83 96 97 98 89 72 47 14 678909876
32 61 82 95 100 99 90 73 48 15 56789098765
31 60 81 94 93 92 91 74 49 16 4567890987654
30 59 80 79 78 77 76 75 50 17 345678909876543
29 58 57 56 55 54 53 52 51 18 23456789098765432
28 27 26 25 24 23 22 21 20 19 1234567890987654321
11111 5432*
2222 543*1
333 54*21
22 5*321
1 *4321
1
121
12321
1234321
1 1 1
12 21 21
123 321 321
1234 4321 4321
1234554321 54321
Page 5 of 8
1
2*2
1
3*3*3
232
4*4*4*4
45654
4*4*4*4
78910987
3*3*3
2*2
1
1
11
23
12 13
456
13 14 15
7 8 9 10
14 15 16 17
11 12 13 14 15
5
1
54
212
543
32123
5432
4321234
54321
1 1 2 3 4 5
23 6 7 8 9
345 10 11 12
4567 13 14
56789 15
11111
1234
0000
2341
111
3421
00
4321
1
1 11111
4 9 16 1 1
25 36 49 64 81 1 1
100 121 144 169 196 225 256 1 1
289 324 361 400 441 484 529 576 625 11111
1
123
1 12345
12 1234567
123 123456789
1234 1234567
12345 12345
123
1
555555555
*000*000* 544444445
0*00*00*0 543333345
00*0*0*00 543222345
000***000 543212345
543222345
Page 6 of 8
543333345
544444445
555555555
1
24
369
1
4 8 12 16
11
5 10 15 20 25
121
6 12 18 24 30 36
1331
7 14 21 28 35 42 49
14641
8 16 24 32 40 48 56 64
9 18 27 36 45 54 63 72 81
10 20 30 40 50 60 70 80 90 100
1 11111
12 10001
358 10001
13 21 34 55 10001
89 144 233 377 610 11111
12345 1
21234 32
32123 456
43212 10 9 8 7
54321 11 12 13 14 15
1 1
1
2 2
232
33
34543
4
4567654
33
567898765
2 2
1 1
1 1
26 121
3 7 10 12321
4 8 11 13 1234321
5 9 12 14 15 123454321
1
2 2 1 2 3 4 5
3 3 16 6
4 4 15 7
3 3 14 8
2 2 13 12 11 10 9
1
N=39714
39174
9174
174
74
4
Page 7 of 8
Page 8 of 8

You might also like