Write a program to implement basic data types and control structure (loop, if-else etc ) in java.

Program Code:
public class Test 
{
public static void main(String args[]) 
{
for(int x = 1; x < 10; x = x+1) 
{
System.out.print("value of x : " + x );
System.out.print("\n");
}
}
}

Output: 
value of x 1
value of x :2
value of x :3
value of x:4
value of x :5
value of x:6
value of x :7
value of x :8
value of x:9
value of x:10


Thanks
Mukesh Rajput
Mukesh Rajput

Mukesh Rajput

I am a Computer Engineer, a small amount of the programming tips as it’s my hobby, I love to travel and meet people so little about travel, a fashion lover and love to eat food, I am investing a good time to keep the body fit so little about fitness also..

Post A Comment:

0 comments: