Java
System.out.println(“1\t2\t3\t4\t5\t6\t7\t8\t9”);
1 2 3 4 5 6 7 8 9
------------------------------------------------------------------
1 2
3 4
5
6
7 8 9
2 4 6 8 10 12 14 16 18
3 6 9 12 15 18 21 24 27
4 8
12 16 20
24 28 32
36
…
9 18 27
36 45 54
63 72 81
Write a program as follows:
import java.util.Scanner;
public class Mult_Table {
public static void main(String[ ] args) {
for(int i=1; i <= 9; i++)
System.out.print(i +" \t ");
for(int i=1; i <=9; i++){// nested loop
System.out.print(\t" ");
for(int j=1; j<= 9; j++)
System.out.print(i*j +" \t ");
}
}
}
-----------------+-------------------+
Program2
import java.util.Scanner;
public class Sum {
public static void main(String[ ] args) {
int n,x, sum=0,flag;
Scanner scan = new Scanner(System.in); System.out.print("Enter number between 2 and 10 "); n = scan.nextInt();
if( n<2||n>10)
{ System.out.print("invalid input");
return;. }
do{//outer loop
for(int i=1; i <= n; i++){//inner loop
x=scan.nextInt();
sum+=x;
}
System.out.println(" do you want to sum up again 1 for yes 0 for no");
flag=scan.nextInt();
}while(flag==1);
}
}
Java Submit a program in a .java file. The program should print a multiplication table for...
Write a Java program that uses nested for loops to print a multiplication table as shown below. Make sure to include the table headings and separators as shown. The values in the body of the table should be computed using the values in the heading e.g. row 1 column 3 is 1 times 3. * | 1 2 3 4 5 6 7 8 9 4 | 1| 1 2 3 456 7 8 9 2 | 2 4 6.8...
Write a program that prints out multiplication table: 1. In the main loop, it should ask a user to enter a number in the range of 1 to 12. Exit the program upon input out of range (eg., 0 or 13). 2. Output the multiplication table from 1 to 12. Possible output: Enter the number (1-12): 9 9 * 1 = 9 9 * 2 = 18 9 * 3 = 27 9 * 4 = 36 9 * 5...
in Java programming Using IF statement, write a program that prints multiplication table for 1-10. Sample Program Output. 1 2 3 4 5 6 7 8 9 10 1 1 2 3 4 5 6 7 8 9 10 2 2 4 6 8 10 12 14 16 18 20 3 3 6 9 12 15 18 21 24 27 30 4 4 8 12 16 20 24 28 32 36 40 5 5 10 ...
Using Python, Can someone please assist in the following: These are the hints: Summary This week's lab is to create a simple multiplication table using nested loops and if statements. Prompt the user for the size of the multiplication table (from 2x2 to 10x10). Use a validation loop to display a warning if the number is less than 2 or greater than 10 and prompt the user to enter the data again until they enter a valid number Put a...
5.4 Java Create a program that generates SuperLotto lottery numbers. Create a class called SuperLottoPlus.java Create a method called generateSuperLottoNumbers() that returns an array of 6 random SuperLotto lottery numbers. The first 5 numbers must be from the range 1 to 47 The 6th number (the MEGA) must be from 1 to 27. Create a method called printTicket() that takes an integer array as an parameter it will loop through the integer array and print out the data Display the...
Using java E6.17 Write a program that prints a multiplication table, like this: 1 2 3 4 56 7 8 9 10 2 4 6 8 10 12 14 16 18 20 3 6 9 12 15 18 21 24 27 30 10 20 30 40 50 60 70 80 90 100
use Quincy Write a program to generate the multiplication table of an integer number (entered by the user) using for loop. You should only use the main() function. Sample output Enter an integer: 9 9*1=9 9*2=18 9*3=27 9*4=36 9*5=45 9*6=54 9*7=63 9*8=72 9*9=81 9*10=90
The following question based on MIPS assembly language: Given this Intermediate File of a Compiler #1 Indx Indx tl #2 t3 t4 Indx (20) tl t2 t3 t4 t5 .= (2) #25 #1 #10 MLK #1 #1 t5 JGT (5) * t6 Indx t8 #1 #10 MLK #1 tl1 t8 t9 t10 tl1 t12 t13 CBA[t7] 10) (12) * #2 (13) (14)9 (15) t12 (16) := (17)+ (18) := t14 19) JMP (20) t10 ZYX[tl3] #1 Indx t14 Indx Optimize...
In Java Please Create A Program For The Following; Please Note: This program should be able accept changes to the values of constants ROWS and COLS when testing the codes. Switch2DRows Given a 2D array with ROWS rows and COLS columns of random numbers 0-9, re-order the rows such that the row with the highest row sum is switched with the first row. You can assume that 2D arrau represents a rectangular matrix (i.e. it is not ragged). Sample run:...
Write a C program to print the figure as follows. 5, Write a C program to print the figure as follows. 1 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 4 6 8 10 12 14 16 18 9 12 15 18 21 24 27 16 20 24 28 32 36 25 30 35 40 45 36 42 48 54 49 56 63 64 72 81 1 Tip: use loop.