Write a java program to display the series 7,6,5,4,3,2,1 using for loop.
Answers
Answered by
1
Language:
JAVA
Program:
public class oh {
public static void main(String[] args) {
for (int i = 7; i > 0; i--)
{ System.out.print(i + " "); }
} }
Output:
Consider the attachment.
Explanation:
- initialize value at as i =7
- decrease it by 1 every time the loop runs as long as the value id greater than 0.
Attachment:
Attachments:
Answered by
42
Required Answer :
Question:
- Write a java program to display the series 7,6,5,4,3,2,1 using for loop.
Program:
This is the required Java program to display the series 7,6,5,4,3,2,1.
/*This is the required program to display the series 7,6,5,4,3,2,1*/
public class Serrev
{
public static void main (String args[])
{
for(int k=7;k>=1;k--)
{
System.out.print(k+"");
}
}
}
The output will be as follows:
7654321.
Attachments:
Similar questions
Biology,
1 month ago
Political Science,
1 month ago
Computer Science,
2 months ago
History,
2 months ago
Science,
9 months ago
Math,
9 months ago