Wednesday, June 6, 2012

/* Program to display numbers between 1 to 5*/

SYNTAX:
Do 
{
         <Block of statements>;
}while(<boolean condition>);
PROGRAM:
/* Program to display numbers between 1 to 5*/
public class ex
{
  public static void main(String[] args)  
{

     int i =0; 
    do
    {
       System.out.println("i is : " + i);
        i++;
     }while(i < 5);
   
  }
}
SAMPLE OUTPUT:
i is : 0
i is : 1
i is : 2
i is : 3
i is : 4
TRY YOURSELF:9
1)Write a program to display the numbers between 25 to 50.

No comments:

Post a Comment

Animated Social Gadget - Blogger And Wordpress Tips