Uploaded by Karma Dechen Dema

c programming simple practical questions

advertisement
1. Print 1 1 /2 1/3
1/4 1/5 . . . 1/N using ‘Yes return and No argument’ function.
2. Print sum of first natural number using Yes return and yes argument’ function.
3. Print factorial of a N number using ‘no return and yes argument’ function.
4. Print *
stars using ‘No return and No argument’ function.
**
***
****
*****
*
5. Print factorial of N number using recursive function.
6. Print sum of first natural number using recursive function.
7. Get base and exponent from the users and display their answer using recursive function.
8. Print multiplication of 3 using recursive function.
9. Check whether a number is even or odd using switch and function.
10. Print this pattern 1
using for loops.
22
333
4 4 44
55555
11. Print this pattern 1
using for loops.
12
123
1234
12345
12. Print this pattern using mix loops (while and for loop) and function.
*****
*****
*****
*****
*****
13. Check whether a letter is a vowel or consonant using any selection statement and
function.
14. Check whether a person is eligible to vote using switch case and function.
15. Print total number of odd and even numbers from 16 to 90
16. Calculate the sum of even number from 1-30
17. Print and count total number of number divisible by 5 in range 5-555
18. Check whether a year is leap year or not using nested IF. Clue: a year is a leap year if it
is divisible by 4, 100 and 400 or divisible by 4 but not 100.
19. Print the average and total number of odd from 1-15.
20. Print this pattern using mix loops (while and for loop) and function.
12345
12345
12345
12345
Download