Write a program to input the values of start,step and end and then display natural numbers from start till end in equal intervals of step.
For example : if the values of start as 14, end as 31 and step as 6
The values should be displayed as
14
20
26
32
Answers
Answered by
0
Answer:
Java program... hope it's helpful
Explanation:
import java.util.*;
class series
{
public static void main()
{
Scanner sc=new Scanner(System.in);
System.out.println(“enter the value of start”);
int start= sc.nextInt();
System.out.println(“enter the value of steps");
int step=sc.nextInt();
System.out.println("enter the value of end");
int end=sc.nextInt();
while(start<=end);
{
System.out.println(start);
start=start+step;
}
}
}
Similar questions