Here are collection of programs using loop. here,You have programs written in while,do..while and for loop separately. Some are done using all loops as a sample to make you understandable. Then programs preceded by them can be written in same manner.Some programs are with 'if structure' depending upon requirements by question.
Read them now.
you can use while,do..while and for loop
Q1) Write a program to print/display 1 to 10 natural numbers.
solution
Q2) Write a program to print/display 1 to n natural numbers.
solution
Q3) Write a program to print/display all even numbers lying between 1 to n natural numbers.
solution
Q4) Write a program to print/display all odd numbers lying between 1 and 100.
solution
Q5) Write a program to print/display 100 to 1 natural numbers.
solution
Q6)Write a program to input your name and address and to display them 40 times.
solution
Q7) Write a program to print/display 1,8,27... to 10th term.
solution
Q8) Write a program to print/display 2,4,6,8,10,12... to 15th term.
solution
q9)Write a program to display multiplication table of a number .
solution
q10)Write a program to print/display 1,6,11,16....nth term.
solution
q11)Write a program to print/display 1,111,1111,11111,.... to nth term.
solution
Q12)Write a program to get sum of 1 to 10 natural numbers.
solution
q13)Write a program to get/sum of all even numbers lying between 1 to n natural numbers.
solution
q14)Write a program to print/display all characters from a to z.
solution
q15)Write a program to print/display all ascii values of letters from A to Z and a to z..
solution
Q16)Write a program to print/display 11111,1111,111,11,1 to nth term.
solution
Q17)Write a program to convert binary no. into decimal number system.
solution
Q18)Write a program to convert decimal number into binary.
solution
Q19)Write a program to convert decimal number into octal.
solution
Q20)Write a program to convert decimal number into Hexadecimal.
solution
q21)Write a program to convert hexadecimal number into decimal .
solution
q22)Write a program to convert octal no. into decimal number system.
solution
q23)Write a program to convert binary no. into octal number system.
solution
q24)Write a program to convert binary no. into hexadecimal number system.
solution
q25)Write a program to convert hexadecimal number into binary number system.
solution
q26)Write a program to get factorial value of a positive number
if number =5 then its factorial value=5x4x3x2x1=120
solution
q27)Write a program to print/display all factors of number 'n'.
e.g. if n= 6 then factors are1,2,3,6.(all can divide it)
solution
q28)Write a program to print/display all perfect square numbers lying between 1 and 'n'.
e.g. if n= 20 then perfect squares are 1,4,9,16....
solution
q29)Write a program to print/display 1+1,1+2,1+3,1+4,1+5,.... to nth term.
solution
q30)Write a program to print/display 1+1/1,1+1/2,1+1/3,1+1/4,1+1/5,.... to nth term.
solution
q31)Write a program to test whether a number is prime or not.
solution
q32)Write a program to get sum of 1+1,1+2,1+3,1+4,1+5,.... to nth term.
solution
q33)Write a program to test whether a number is palindrome or not.
solution
solution
q34)Write a program to get series 0,1,1,2,3,5,8....15th term.
(it is called Fibonacci series)
solution
q35)Write a program to reverse a number.
123=321
solution
q36)Write a program to get sum of all digits present in a number.
e.g 123=3+2+1=6
solution
q37)Write a program to get/display digits which are in even position present in a number.
e.g 123=2
solution
q38)Write a program to get/display digits which are odd positioned in a number.
e.g 123=1 and 3
solution
q39)Write a program to get/display digits which are even in a number.
e.g 12345=2 and 4
solution
q40)Write a program to get/display digits which are odd in a number.
e.g 12345=1 and 3 and 5
solution
q41)Write a program to read age of any 100 persons and count the number of persons in the age group between 20 and 40.
solution
Q42)Write a program to get 0.9,0.99,0.999,0.9999.....nth terms.
solution
q43)Write a program to get sum of (2x3)/5+(4x5)/7+(6x7)/9+,.... to nth term.
solution
q44)Write a program to get sum of 1
2x1+2
3x3+3
4x5+..............................nth terms.
solution
q45)Write a program to get sum of 1+3/4+7/16+15/64..............................nth terms.
solution
q46)Write a program to get sum of x+ x
2/2+x
3/3+x
4/4+.............................nth terms.
solution
q47)Write a program to count number of digits present in a number.
e..g. in 453=3 digits
solution
continue with nested loop