class Alphabets { public static void main(String args[]) { char ch; for( ch = 'a' ; ch <= 'z' ; ch++ ) System.out.println(ch); } }
Showing posts with label for loop. Show all posts
Showing posts with label for loop. Show all posts
Saturday, 29 June 2013
Print alphabets in java
Saturday, 15 June 2013
java for loop program
public class Test { public static void main(String args[]) { for(int x = 10; x < 20; x = x+1) { System.out.print("value of x : " + x ); System.out.print("\n"); } } }
Thursday, 13 June 2013
program for nested for loop
mport java.io.*;
class simple_nested_forloop
{
public static void main(String args[])
{
for(int r=1;r<=3;r++)
{
for(int c=1;c<=3;c++)
{
int sum;
sum=r+c;
System.out.println(r+" + "+c+" = "+sum);
}
}
}
}
class simple_nested_forloop
{
public static void main(String args[])
{
for(int r=1;r<=3;r++)
{
for(int c=1;c<=3;c++)
{
int sum;
sum=r+c;
System.out.println(r+" + "+c+" = "+sum);
}
}
}
}
program for - print even number with the help of for loop
import java.io.*;
class simple_even_print_with_for_loop
{
public static void main(String args[])
{
for(int i=1;i<=50;i++)
{
if(i%2==0)
System.out.println(i);
}
}
}
class simple_even_print_with_for_loop
{
public static void main(String args[])
{
for(int i=1;i<=50;i++)
{
if(i%2==0)
System.out.println(i);
}
}
}
Subscribe to:
Posts (Atom)