How to print 99,9,89,8,79,7.. using java
// common way to write
int a=9,n=10 ; // n value you can take anything
for(int i=1;i<=n;i++)
{
if(i%2==1)
{
System.out.print(a*10+9);
}
else
{
System.out..print(a);
a--;
}}
// common way to write
int a=9,n=10 ; // n value you can take anything
for(int i=1;i<=n;i++)
{
if(i%2==1)
{
System.out.print(a*10+9);
}
else
{
System.out..print(a);
a--;
}}
Nice sir
ReplyDelete