Programms in C - Excercise Questions
Programms in C - Excercise Questions
Write a C program to find the greatest common divisor (GCD) of the two given positive
integers.
2. Write a C program that prints a given positive integer in reverse order and also sum of the
individual digits involved in the given integer.
3. Write a C program to find the commission on a salesman's total sales . The commission on
a salesman’s total sales is as follows:
a) If sales <100, then there is no commission.
b) If 100>=sales <=500, then commission = 10% of sales.
c) If sales > 500, then commission = 100+8% of sales above 500.
4. Write a C program that adds first seven terms of the following series 1/1! +2/2! + 3/3!
+ ..........
5. Write a C program to find a peculiar two digit number which is three times the sum of its
digits?
6. List of Pyramids
ABCDEFGGFE DCBA
AB C D EF F ED C BA
ABCDEE DCBA
AB C D D C BA
ABCCBA
ABBA
AA
AB C D EF G F ED C BA
AB C DE F ED C BA
ABCDE DCBA
ABCDCBA
AB C BA
ABA
A
7. Write a C program to find the roots of a quadratic equation using Pointers and Functions.
8. Write a C function that defines two strings as parameters, as follows, and checks whether
the second string (str2) is a substring of the first one (str1).
9. Write a C program to merge two unsorted one dimensional arrays in descending order
10. Write a C program to print the Given pyramid
1
12
123
1234
12345
.
.
.
n
11. Write a C program to get the maximum and minimum values of a Data type
12. Write a C program to get the maximum and minimum values of a Data type
13. Write a C program to Sort the list of integers using Bubble Sort
14. Write a C program to find gcd of each of the two consecutive elements of an array. write
a function GCD(a,b) that would take two consecutive elements of the array as arguments and
return the GCD.
15. Write a C program to Create a Paint brush using graphics functions
16. Write a C program to display the message "Welcome to C" without a Semicolon.
17. Write a C program to display the System date and Change the system date if necessary.
18.Write a C program to check whether the given number is single digit or more
19.Write a program in c to accept any character and check whether the given character is
capital or small using Ctype.h library file
20.Write a program in c to accept any character and check whether the given character is
capital or small
21.Write a C program to print all Armstrong numbers between 1 to 1000.
22.Write a C program to delete an element from the array.
23.Write a C program to Insert an element at the 'n' th position
24.Write a C program to print all Combinations of characters A, B, C
25.Write a C Program to find HCF (GCD) between two numbers using Goto statement
26.Write a C program to find the roots of a Quadratic equation using if -else ladder and goto
statement
27.Write a C program to Convert any Decimal number into Binary coded decimal
28.Write a C program to Calculate the sum of the series sum=1+1/x+1/x2+1/x3+...........+1/xn
29.Write a c program to obtain the Sum of the first and last digit of the number, if a four digit
number is inputted through the keyboard
30.Write a C program to convert Fahrenheit degrees into Centigrade and Vice-Versa
31.Write a C program to check whether the given number is positive, negative or zero
32.Write a C program to find the greatest number between four numbers using if-else ladder
33.Write a 'C' program to perform the selected arithmetic operation by taking two integer
values using Switch Statement
34.Write a Program to print a Histogram showing the frequencies of different word length
35.Write a C program to find the factors of a given integer.
36.Write a C program to generate the Fibonocci series using Recursion.
37.Write a C program to determine the given integer is Palindrome or not.
38.Write a C program to calculate the sum of factors of a number.
39.Write a C program to detect whether the given integer is Armstrong number or not.
40.Write a C program to check whether the given integer is Magic number or not.
41.Write a C program to determine the given integer is Perfect number or not.
42.Write a C program to check whether the given integer Prime number or not.
43.Write a C program to solve the Towers of Hanoi problem using Recursive function.
44.Write a C program to find the GCD (greatest common divisor) of two given integers using
Recursive function.
45.Write a C program to find the GCD (greatest common divisor) of two given integers
without using recusive function
46.Write a C program to delete n Characters from a given position in a given string.
47.Write a C program to insert a sub-string in to given main string from a given position.
48.Write a C program to read in two numbers, x and n, and then compute the sum of this
geometric progression: 1+x+x2+x3+………….+xn
49.Write C programs that use both recursive and non-recursive functions to find the Write C
programs that use both recursive and non-recursive functions to find the factorial of a given
integer.
50.Write a C program to construct a pyramid of numbers.
/*
1
23
456
7 8 9 10
11 12 13 14 15
*/
51.Write a C program to displays the position or index in the string S where the string T
begins, or -1 if S doesn't contain T.