Monday, June 24, 2013

Netbeans Lesson 7

Example 1. Write a program to print the output like below.
1
10
100
1000
.
.
10 term.
Program:-

int a,b;
a=1;b=1;
while (a<=10)
{
system.out.print(b)
b=b*10;
a++;
}

Netbeans Lesson 6

While Loop:
While statement is used to execute the set of instruction in its loop untill the condition is true. It will keep on executing the commands in its loop untill the condition become false.
Syntax :
while (<expression or condtion>)
{
set of statements
.
.
n;
}

Example
To the following series with while loop.
1,2,3,4,----------10

int a;
a=1;
while(a<=10)
{
System.out.print(a);
a++;
}

if want to print this in c Language or c++ then simply write printf(a) in c and cout<<a in c++ to get the same result.

  A Potential Showdown: Kamala Harris vs. Donald Trump As the political landscape gears up for the next election cycle, the prospect of a fa...