skip to main
|
skip to sidebar
Era Of Skills
Where Your Need Ends
Home
Sitemap
Home
C Tutorial
Programming
C Programming
Java Programming
Data Structure Programming
SiteMap
Showing posts with label
Looping Statements
.
Show all posts
Showing posts with label
Looping Statements
.
Show all posts
Saturday, August 20, 2011
While Loop in java
6:30 PM
Bimalpreet Singh
No comments
class While
{
public static void main(String arg[ ])
{
int sum=0,n=1;
while(n<=15)
{
sum=sum+n;
n=n+1;
}
System.out.println("Sum of first 15 nembers: "+sum);
}
}
Read More
Tweet
Do While Loop in Java
6:29 PM
Bimalpreet Singh
No comments
class DoWhile
{
public static void main(String arg[ ])
{
int sum=0,n=1;
do
{
sum=sum+n;
n=n+1;
}while(n<=20);
System.out.println("Sum of first 20 nembers: "+sum);
}
}
Read More
Tweet
Find Sum using For Loop in java
6:29 PM
Bimalpreet Singh
No comments
class For
{
public static void main(String arg[ ])
{
int sum=0;
for(int n=1;n<=40;n++)
{
sum=sum+n;
}
System.out.println("Sum of first 40 nembers: "+sum);
}
}
Read More
Tweet
Show concept of Labelled Continue Break in java
6:28 PM
Bimalpreet Singh
No comments
//Show concept of Labelled Continue Break in java
class LabelledContinueBreak
{
public static void main(String arg[])
{
loop:
for(int i=1;i<100;i++)
{
System.out.println();
if(i>=10)
{
break;
}
for(int j=1;j<100;j++)
{
System.out.print(" *");
if(j==i)
{
continue loop;
}
}
}
System.out.print("Termination by BREAK");
}
}
Read More
Tweet
Print the pattern
6:23 PM
Bimalpreet Singh
No comments
Print 1
2 2
3 3 3
import java.io.*;
class Pattren
{
public static void main(String arg[ ])
{
BufferedReader in=new BufferedReader(new InputStreamReader(System.in));
int n;
try
{
System.out.println("Enter the number of lines you want in your ouput: ");
n=Integer.parseInt(in.readLine());
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
{
System.out.print(" "+i);
}
System.out.println();
}
}
catch(Exception e){ }
}
}
Read More
Tweet
Tweet This on Twitter
Share this on Facebook
Subscribe for Email feed
Enter your email address:
Delivered by
FeedBurner
C Programming
Array
C Programs
Decision Making Statements
Functions
Iterative Statements
String
Java Programming
Array in Java
Looping Statements
Operators
Algorethmic Solution
Arrays
Linked List(Self Referential structure)
Queue
Recursion
Stack
Miscellaneous
Searching
Sorting
Blogumulus by
Roy Tanck
and
Amanda Fazani
via
BloggerStop.Net
Add Smilies