C-for-whle-loop-6

  • October 2019
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View C-for-whle-loop-6 as PDF for free.

More details

  • Words: 327
  • Pages: 1
1. Print your name five times. 2. Print your name n times. Input n from user. 3. Ask and print user’s name n times. 4. Input user’s name and age. Now print user’s name age number of times on screen. 5.Print the numbers from 1 to 10. 6.Print the numbers from 10 to 1. 7. Print the numbers from 1 to n. 8. Print the numbers from n to 1. 9. Print odd numbers between 1 and 20. 10. Print even numbers between 50 and 25. 11. Print odd numbers between 1 and n. Input n from user. 12. Calculate sum of odd numbers between 1 and n. 13. nt even numbers between 1 and n. 14. Accept a choice (‘o’ or ‘e’) from user. If choice is ‘o’ or ‘O’, find sum of odd numbers between 1 and n. 15. Accept a choice (‘o’ or ‘e’) from user. If choice is ‘e’ or ‘E’, find products of even between 1 and n. 16 .Accept a choice (‘o’ or ‘e’) from user. If choice is ‘o’ or ‘O’, find sum of odd numbers else if choice is ‘e’ or ‘E’, find product of even numbers between 1 and n. In case of other choice give message “Invalid choice.” 17 Print multiplication table of 9. 18 Print multiplication table of n. 19 Find sum of digits of an integer. 20 Find product of digits of an integer. 21 Find sum of odd digits of an integer. 22 Accept a choice (‘o’ or ‘e’) from user. If choice is ‘o’ or ‘O’, find sum of odd digits else if choice is ‘e’ or ‘E’ then find product of even digits of an integer. 23. Find reverse of an integer. 24. Check whether an integer is a prime or not. If the integer is prime, print “ PRIME NUMBER” else if the integer is not prime, then print “NOT PRIME NUMBER”. 25 Print all prime numbers between 1 and n.