Computer Science, asked by gurvipatel13, 4 months ago

Write a java program to display the series 7,6,5,4,3,2,1 using for loop.

Answers

Answered by BrainlyProgrammer
12

Given Series:

  • 7,6,5,4,3,2,1

Logic:-

  • Run a reverse loop from 7 to 1 and print the loop value

Answer:

//Java program to display the series 7,6,5,4,3,2,1

package Programmer;

public class Serrev{

public static void main (String ar []){

for(int I=7;I>=1;I--){

System.out.print(I+" ");

}

}

}

Variable Description:-

  • I:- loop variable.

Explaination of the program:-

  • The program runs a loop from 7 to 1.
  • in each iteration, loop value is printed.
Attachments:
Answered by Rakshitaa007
1

Answer:

Example in C programming:

#include <stdio.h>

int main() {

int a = 6, b = 6;

// a is displayed

// Then, a is increased to 7.

printf("%d post-increment n", a++);

// b is increased to 7

// Then, it is displayed.

Similar questions