Write a program that produces the following output for a random number of digits on a row and a random number of rows.
1******
12*****
123****
1234***
12345**
123456*
1234567
Write a program that calculates the following series: i=1n(12)n=12+14+18+...+12n
(hint: we need to talk about integer division)
Use for loops to write a code segment that prints the following output.
1 2 3 4
2 4 6 8
3 6 9 12
4 8 12 16
5 10 15 20
1)
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.print("Enter n: ");
int n = sc.nextInt();
for(int i=1 ; i<=7 ; ++i){
for(int j =1 ; j <= n; ++j){
if(j <= i)
System.out.print(j);
else
System.out.print("*");
}
System.out.println();
}
}
}
---------------------------------------------------------------------------------------------------------------------------------------------------
SEE OUTPUT

Thanks, PLEASE COMMENT if there is any concern.
2)
import java.util.*;
class Main {
public static void main(String[] args) {
for(int i=1 ; i<=5 ; ++i){
for(int j =1 ; j <= 4; ++j){
System.out.print((i*j) + " ");
}
System.out.println();
}
}
}
---------------------------------------------------------------------

Write a program that produces the following output for a random number of digits on a...
Write a Java program which implements both the while and for loop, as needed, to draw the illustrations given below. Shape 1 123456789 12345678 1234567 123456 12345 1234 123 12 1 Shape 2 ************* ************* ************* ************* ************* Shape 3 ============ * * * * * * * * * * ============ Hint: To draw the shapes above, you can use nested for loops to accomplish the task. The outer for loop iterates on each row, and the inner for...
Write a c++ program to calculate the approximate value of pi using this series. The program takes an input n that determines the number of values we are going to use in this series. Then output the approximation of the value of pi. The more values in the series, the more accurate the data. Note 5 terms isn’t nearly enough. You will try it with numbers read in from a file. to see the accuracy increase. Use a for loop...
To submit this assignment Online, copy and paste your code as well as the output window here Q3. Write a program to print the following pattern 12 123 1234 12345 123456 1234567 Hint: Use a loop inside a loop. for Li-7:i++) for each value of i, value of j will be incremented from 1 to the current value of To submit this assignment Online, copy and paste your code as well as the output window here: 9444**9* **eKEHEeneee****kaa**4a44 DOLL F8...
Write a C program which calculates how many digits a number has and prints each digit in reserve order with space in between(no space after the last digit). The number > 0 and has no more than 5 digits. (optional] It is better to write two functions. One is designed for printing number in reverse order and the other is for counting the number of digits. Given that the value of number (which is an int variable) is 12345, the...
(Java Please) Sum of Digits Write a program that will sum the digits of a number input by the user. For example, if the user enters the number 1234, the sum of the digits will be 10 (1 + 2 + 3 + 4 = 10). The user will enter a number with at least 4 digits (greater than 1000). That value will be sent to a method which will return the sum. Sample Output 1: SUM OF DIGITS -------------...
2.29 Random Phone Number (Java) Write a program that creates and prints a random phone number of the form 668-555-xxxx where xxxx is a 4-digit randomly generated number. Include the dashes in the output. Think through how you can guarantee a 4-digit number. Your output should look like: A random phone number: 678-555-1234 Given: import random number public class PhoneNumbers { //----------------------------------------------------------------- // Produces a random phone number of the form 678-555-xxxx. //----------------------------------------------------------------- } }
Write an application (SpaceDigits) that: (in java) a. inputs one number consisting of five digits from the user, separates the number into its individual digits and prints the digits separated from one another by three spaces each. For example, if the user types in the number 42339, the program should print “4 2 3 3 9.” (Hint: The number input is five digits long, dividing it by 10000 gives the leftmost digit. digit1 = number / 10000 ) b. determines...
The convert_phone_number function checks for a U.S. phone number format: XXX-XXX-XXXX (3 digits followed by a dash, 3 more digits followed by a dash, and 4 digits), and converts it to a more formal format that looks like this: (XXX) XXX-XXXX. Fill in the regular expression to complete this function. 1 4 import re 2 - def convert_phone_number(phone): 3 result = re.sub) return result 5 6 print(convert_phone_number("My number is 212-345-9999.")) # My number is (212) 345-9999. 7 print(convert_phone_number("Please call 888-555-1234"))...
Java ((without using array))
3. Write a program that reads a 7-digit number and then shuffles its digits randon Sample run: Please enter a number 123456 Wrong too small! Sample run: Please enter a number: 1234567 The shuffled number is: 4356271 Sample run: Please enter a number 1000001 The shuffled number is: 0100100
Hi, please this is for Python3.6 Write a program that asks the user to enter the number of rows and number of columns.The program would then print the number of columns not as stars but as digits (eg: 1234 if the number of columns is 4) eg: Enter the number of rows: 4 Enter the number of columns:8 12345678 12345678 12345678 12345678