write a programming in Java that displays" I want to learn programming in Java" 50 times using the for loop
Answers
Answered by
9
class program
{
public static void main(String[]args)
{
for(int i=1;i<=50;i++)
{
System.out.println("I want to learn programming in Java");
}
}
}
{
public static void main(String[]args)
{
for(int i=1;i<=50;i++)
{
System.out.println("I want to learn programming in Java");
}
}
}
Answered by
1
Following are the program in java
class Main // Main class
{
public static void main(String[]args) // main //method
{
int k; // variable declaration
for(k=1;k<=50;k++) // iterating the loop
{
System.out.println(" I want to learn programming in Java"); // print
}
}
}
Explanation:
Following are the description of program
- Declared the variable "k" of "int" type.
- Iterated the for loop in this we initialize k to 1".This loop will we execute less then equal to 50 that's why we provide the condition less then equal to 50 .
- In every iteration the statement inside the for lop will be executed also increases the value of "k" variable by 1.
Similar questions
Social Sciences,
1 year ago
Math,
1 year ago