Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. Loops (While, Do..While, For)
  2. Q1) Write a C program to print numbers from 0 to 100. (You are required to write 3 separate answers each using While, Do..While, For, looping structures).
  3. Q2) Write a C program to calculate and print the total of 10 marks and the average. If the average is less than 50 program should print “Fail!” otherwise “Pass!”
  4. Q3) Write a C program to calculate factorial of a user given number.
  5. Hint:
  6. • Select an appropriate looping structure.
  7. • Factorial of ‘0’ is ‘1’ (0! = 1)
  8. • Ex: factorial of number 5 is calculated as 5! = 5*4*3*2*1
  9.  
  10. Q4) Write a C program to calculate the sum of all digits of a user given number.
  11. • If user input 123 your program should output 6. (calculated as 1+2+3)
  12. Q5) Write a C program to reverse the digits of a number using do-while statement.
  13. Q6) Write a C program to calculate nth power of a given integer. The user input base and exponent. (Do NOT use inbuilt functions, instead use a loop)
  14. Q7) Write a C program to print first 10 numbers of “Fibonacci Sequence”.
  15. Q8) Write a C program to check whether a given number is an Armstrong Number! (Refer to previous flowcharts)
  16. Q9) Write a C program to print all the ASCII values for letters A to Z.
  17. Q10) Write a program to print this pattern.
  18. *
  19. **
  20. ***
  21. ****
  22. *****
  23. Q11) Write a program to check whether a given number is prime or not.
  24. Q12) Write a C program to print all factors of a given integer.
  25. Q12) Write a C program to add all user inputs until user input ‘-1’. And then display the sum.
  26. Q13) Write a C program to read user inputs for an integer array (size = 10) and print the array.
  27. Q14) Re-Write the above code to count all the even numbers in above integer array and display the count.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement