import java.io.*;
public class Deretganjil
{
public static void main (String args[])
{
try
{
BufferedReader NilaiN=new BufferedReader (new InputStreamReader(System.in));
System.out.print("Masukan Nilai N = ");
String input1=NilaiN.readLine();
int N=Integer.parseInt(input1);
int ganjil;
for(int i=1;i<=N;i++)
{
ganjil = 2*i-1;
System.out.print(ganjil+ " ");
}}
catch(IOException e)
{
e.printStackTrace();
}}}
Categories:
java