Tasks - Loops #6
Replies: 78 comments 1 reply
|
Print the multiplication table of 5 using a loop. } public class GCD { } } |
5 Table` ` GCD`import java.util.Scanner; public class GCD { } LCM`import java.util.Scanner; public class LCM { } take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user`import java.util.Scanner; public class Input { } Pattern` ` |
|
Print the multiplication table of 5 using a loop. public class MultiplicationTable { } public class GCD { } public class LCM { } public class Exit { } `import java.util.Scanner; public class StarPattern { } |
Program to print the multiplication table of 5 using a loop`import java.util.Scanner; public class TableOf5 { }` Program to find the HCF of 2 numbers`import java.util.Scanner; public class FindGCD { } Program to find LCM of 2 numbers`import java.util.Scanner; public class FindLCM { } Program to take inputs from user till user presses 'q'. If so, count the number of inputs provided.`import java.util.Scanner; public class CountInputs { } Program to print star pattern`public class StarPatternBasic { } |
Program to print the multiplication table of 5 using a loop`import java.util.Scanner; public class TableOf5 { }` Program to find the HCF of 2 numbers`import java.util.Scanner; public class FindGCD { } Program to find LCM of 2 numbers`import java.util.Scanner; public class FindLCM { } Program to take inputs from user till user presses 'q'. If so, count the number of inputs provided.`import java.util.Scanner; public class CountInputs { } Program to print star pattern`public class StarPatternBasic { } |
|
Print the multiplication table of 5 using a loop. WAP to find the GCD (or HCF) of two numbers. } WAP to find the LCM of two numbers. public class Lcm { } WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user. public class UserInput { WAP to generate and print the following pattern public class RtTrianglePattern { |
|
1-Print the multiplication table of 5 using a loop. ` } ` 2-WAP to find the GCD (or HCF) of two numbers. } ` 3-WAP to find the LCM of two numbers. } ` 4-WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user. ` } ` 5-WAP to generate and print the following pattern: ` } |
|
` public class Table5 { WAP to find the GCD (or HCF) of two numbers. import java.util.Scanner; } WAP to find the LCM of two numbers. import java.util.Scanner; } WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user import java.util.Scanner; WAP to generate and print the following pattern: import java.util.Scanner; ` |
public class TableOfFive { } 2.GCD of Two Numbers: public class HCF { } 3.LCM of Two public class LCM { } 4.WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user public class InputSpecifier { } 5.Star Pattern public class StarPattern { } |
|
FiveTable `import java.util.*; public class FiveTable { GCD `import java.util.*; public class Gcdoftwonumb { } `import java.util.*; public class LCM { } `import java.util.*; public class CounttillQ {
|
|
Program1-Multiplication table: public class Table { Program2-GCD `import java.util.Scanner; public class Gcd { `import java.util.Scanner; public class Lcm { Program4 `import java.util.Scanner; public class Count { Program4 public class Pattern { |
|
Print the multiplication table of 5 using a loop. ' WAP to find the GCD (or HCF) of two numbers. 'import java.util.Scanner; public class HCF { } WAP to find the LCM of two numbers. 'import java.util.Scanner; public class LCM { } ** WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of number of inputs provided.** 'import java.util.Scanner; public class Count { WAP to generate and print the following pattern 'import java.util.*; public class Pattern { |
|
` public class Table { //GCD import java.util.Scanner; //LCM import java.util.Scanner; } import java.util.Scanner; } //PATERN public class pattern { ` |
|
Print the multiplication table of 5 using a loop. import java.io.*; { HCF AND LCM import java.io.*; }`` q to stop import java.io.*; pattern public class pat1 { |
|
`1.Print the multiplication table of 5 using a loop. class table { } 2.WAP to find the GCD (or HCF) of two numbers. import java.util.Scanner; public class Gcd { } 3.WAP to find the LCM of two numbers. import java.util.Scanner; public class Lcm { } 4.WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user. import java.util.Scanner; public class Userinput { } 5.WAP to generate and print the following pattern: public class Pattern { }` |
Code5public class D {
public static void main(String[] args) {
int n = 5;
int m = 5;
for (int i = 1; i <= n; i++) {
for (int j = 1; j <=i; j++) {
System.out.print("*");
}
System.out.println(" ");
}
}
} |
Code1public class E {
public static void main(String[] args) {
for (int i = 1; i <=10; i++) {
System.out.println (5*i);
}
}
} |
Code2import java.util.Scanner;
public class F {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Enter two numbers: ");
int one = Integer.parseInt(s.next());
int two = Integer.parseInt(s.next());
int hcf = 0;
for (int i = 1; i <= one || i <= two; i++) {
if (one % i == 0 && two % i == 0)
hcf = i;
}
System.out.println("HCF of given two numbers is : " + hcf);
}
} |
Code1public class MyClass {
public static void main(String args[]) {
for(int i = 1;i<=10;i++){
System.out.println("5*"+i+"="+5*i);
}
}
} |
Code5public class MyClass {
public static void main(String args[]) {
String pat="";
for(int i = 1;i<=5;i++){
pat+="*";
System.out.println(pat);
}
}
} |
Code3import java.util.*;
public class MyClass {
public static void main(String args[]) {
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
int b = sc.nextInt();
int lcm=(a > b) ? a : b;
while(true){
if(lcm%a==0 && lcm%b==0){
System.out.printf("the lcm of %d and %d is %d",a,b,lcm);
break;
}
++lcm;
}
}
} |
Core3import java.util.*;
public class A{
public static int gcd(int a, int b){
while( a % b != 0){
int rem = a % b;
a = b;
b = rem;
}
return b;
}
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Enter Num1");
int num1 = Integer.parseInt(sc.nextLine());
System.out.println("Enter Num2");
int num2 = Integer.parseInt(sc.nextLine());
int gcd = gcd(num1, num2);
int lcm = (num1 * num2) / gcd;
System.out.println(lcm);
}
} |
|
package main import ( func main() { a := 10 } } |
|
package main import ( func main() { } |
|
package main import ( func main() { a := 10 } lcm = a*b/c } |
|
const readline = require('readline'); const rl = readline.createInterface({ // 1. Print the multiplication table of 5 using a loop: // 2. Find the GCD (or HCF) of two numbers: const num1 = 24; // 3. Find the LCM of two numbers: const lcm = findLCM(num1, num2); // 4. Take integer inputs from the user until the user presses 'q': getUserInput(); // 5. Generate and print the following pattern: // 6. Print the factorial of a number using a loop: const numForFactorial = 5; PS C:\Users\Ujjwa\Music\Test\my-angular-app> node Sample1.js Factorial of 5 is: 120 |





Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Print the multiplication table of 5 using a loop.
WAP to find the GCD (or HCF) of two numbers.
WAP to find the LCM of two numbers.
WAP to take integer inputs from the user till the user presses 'q'. When the user presses 'q', print the count of the number of inputs provided by the user.
WAP to generate and print the following pattern:
All reactions