For loop
package com.company;
import java.util.Scanner;
public class CWH_23_ForLoop {
public static void main(String[] args) {
// for(int i=1; i<=10;i++){
// System.out.println(i);
// }
// Quiz for n odd numbers
// Scanner sc= new Scanner(System.in);
// System.out.println("Enter a number");
// int n=sc.nextInt();
//
// for(int i=1;i<=2*n; i++){
// if(i%2!=0){
// System.out.println(i);
// }
// }
// Quiz
Scanner sc= new Scanner(System.in);
System.out.println("Enter the value of n");
int n=sc.nextInt();
for(int i=n;i>=1;i--){
System.out.println(i);
}
}
}
Comments
Post a Comment