Sei sulla pagina 1di 3

C Practice Problems

1) Find out the summation of 1 to n using for loop. Here n is an integer number
given by user.
E.G- summation of numbers 1 to 5 = 15.

2) Find out the summation of odd numbers from 1 to n and print odd numbers.
Here n is an integer number given by user.
E.G- Summation of odd numbers from 1 to 5 = 9.

3) Find out the summation of even numbers from 1 to n and print even numbers.
Here n is an integer number given by user.
E.G- Summation of even numbers from 1 to 5 = 6.

4) Find out the factorial value of given integer n.

5) Given an integer n. Find out the number is a prime or not.

6) Given an integer n. Find out the number is a perfect number or not.
E.G- 6 is a perfect number because the summation of the factors of 6 (1,2,3 except
6 itself) is equal to 6, means 1+2+3=6.

7) Given a year n. you have to find out the year is leap year or not.
Notes- a year is called leap year if the year is divisible by 4 and not divisible by
100. If the year is divisible by 100 then it must be divisible by 400.

8) Given an integer n. Find out how many leap years are there from 1 to n and
show all the leap years.

9) Given an integer n. Find out the summation (value of S) of the series and show
output.
S= 1/1 + + 1/3 + + 1/5 +.+ 1/n.

10) Given a gloating amount of taka n. Find out how we can change the amount
with minimum number of notes and show the number of denomination.
E.G- 1234 taka can be changed by 2 notes of taka 500, 2 notes of taka 100, 1 note
of taka 20, 1 note of taka 10, 2 notes of taka 2.So the minimum number of
denominations.


11) Assume that there is an analog wall clock with two legs (minute and hour). Find
out the minimum angle in degree between the legs in a given time.
E.G- at 3.00 oclock minimum angle between the legs is 90 degree.

12) Online judge ACM No-100.

13) Convert a decimal number (integer) to its equivalent binary number.
E.G- 10 in decimal=1010 in binary.

14) Convert a binary number to its equivalent decimal number (integer).
E.G- 1010 in binary=10 in decimal.

15) Convert a decimal number (integer) to its equivalent hexa-decimal number.
E.G- 42 in decimal=2A in hexa-decimal.

16) Convert a hexa-decimal number to its equivalent decimal number.
E.G- 2A in hexa-decimal=42 in decimal.

17) Implement strepy, strcat, strcmp, strlen functions using the loops.

18) Implement array and matrix input and output. For matrix output try to use
gotoxy functions to show the properly.

19) Implement array and matrix (2-dimentional) addition.

20) Given a matrix initialized. Implement the inverse matrix, matrix addition,
subtraction and multiplication.

21) Given a string, count how many distinct words are in the string.

22) Given a string, count how many vowels and constants are in the string.

23) Given a string. Convert the whole string to its opposite case means lower to
upper or upper to lower.
E.G- given, My Name Is Awal. And output is - mYnAMEiSaWAL. Or vice versa.

24) Given a string. Convert the odd number words to lower case and even number
words to upper case.
E.G- given, My Name Is Awal. And output is - my NAME is AWAL. Or vice versa.

25) Given a long integer. Find the sum of all the digits in the number.
E.G- Sum of the digit 9264=21.

26) Take the computers bios time from computer and print to screen.

27) Set the computer time by your own time.

28) Implement the bubble sort in an array. (ascending and descending).

29) Given an array with initialized. Find out a number whether it is array or not.

30) Generate the Fibonacci series of n number.
E.G- Fibonacci series (5) = 1,1,2,3,5.

31) Find out the sum of the series S where n is given.
S= 1+2+3+4+5+.+n.

32) Write a program that will add all the even numbers from 1 to n.(n will be
inputted).
E.G- input is 5 and output is 15.

33) Write a program that will add all the odd numbers from 1 to n.(n will be
inputted).
E.G- input is 5 and output is 9.

34) Write a program that will add all the numbers from n1 to n2 divisible by 5 ( n1
and n2 will be inputted).
E.G- input is 5 and output is 6.

Potrebbero piacerti anche