Write a program to print 3,6,9,12....30 using while loop
Answers
Answered by
36
Elements of a Loop are:-
- Intialisation
- Test expression
- Update statement
- Body of the loop.
Types of loop:-
- While loop( entry controlled loop)
- For loop ( entry controlled loop)
- Do while loop (exit controlled loop)
Syntax of while loop:-
{
}
Required program:-
i = 3
while(i <=30)
{
cout<<"\t <<i ;
i = i +3;
}
hope this helps..
Answered by
10
Question:-
Write a program to display the series using while loop.
3 6 9 12...30
Program:-
class Series
{
public static void main(String args[])
{
int a=3;
while(a<=30)
{
System.out.print(a+" ");
a+=3;
}
}
}
Similar questions
Accountancy,
3 months ago
Science,
3 months ago
Math,
7 months ago
English,
7 months ago
Business Studies,
11 months ago