import java.util.*;
class odd
{
public static void main (String arg[])
{
Scanner in = new Scanner (System.in);
int a;
System.out.print ("\n\t Enter the ending number = ");
a=in.nextInt();
do
{
if (a%2!=0)
System.out.print ("\n\t "+a);
--a;
}while (a>0);
}
}
screen otherwise not.
{
if (a%2!=0)
System.out.print ("\n\t "+a);
--a;
}while (a>0);
}
}
Note:
In this program if we divide a by 2 and it do not returns 0, then it will be printed on screen otherwise not.
No comments:
Post a Comment