Write a short program to print the following series 1 4 7 10 to 40
Answers
Answered by
1
Answer:
//Program to print the following series using JAVA
import java.io.*;
import java.util.*;
class Series{
public static void main(String args [ ]) throws Exception {
Scanner sc = new Scanner(System.in);
//Printing the series using a for loop
for(int i =1; i<=40;i=i+3){
System.out.println(i);
} //Closing of for loop
}
}
Explanation:
Similar questions