Building a multiplication table 2
Write a program that prints the multiplication table as shown below:
Write a program that prints the multiplication table as shown below:
for i in range(1,11): for j in range(1,11): print(f'{i*j:<5}',end='') print()
n = int(input()) for i in range(1,n + 1): for j in range(1,n + 1): print(i*j, end =" ") print()
Numbers are not tidy and must be arranged through F-Stroving
num = 10 for i in range(1,num+1): for j in range(1,num+1): print(f"{i * j:5}",end="") else: print("\n")
In sorting results with F-Stroving it is best to align the results from one side and also do not require the Else section and also write n \ inside print because blank creates a new line
Thank you for the comment you gave
num = int(input('Number: ')) a = num**2 for i in range(1,num+1): for j in range(1,num+1): print(i*j,end=' '*(1+len(str(a)) - len(str(j*i)))) print()
size = 10 for i in range(1, size + 1): row = "" for j in range(1, size + 1): row += str(i * j).ljust(4) print(row)
num1 = int(input('Number1:')) num2 = int(input('Number2:')) for i in range(1,num1+1): for j in range(1,num2+1): print(f'{i*j:<4}',end='') print()
for i in range(1:11): for j in range(1:11): print(f{i*j}:<5, end="")
package Tax.App.cmd; public class Jadval_Zarb2 { public static void main(String[] args) { for (int i = 1; i < 11; i++) { for (int j = 1; j < 11; j++) { if (i * j > 9) System.out.print(i * j + " "); else System.out.print(i * j + " "); } print(3); } } public static void print(int x) { for (int i = 0; i < x; i++) { System.out.println(); } } }
package opp; public class swit { public static void main(String[] args) { for(int i = 0 ; i < 10;i++) { for(int j = 0 ;j<10;j++) { System.out.print((i+1)*(j+1) + " "); } System.out.print("\n"); } } }
def print_multiplication_table(): # Printing of the table for i in range(1, 11): print(f"{i:2}", end=" ") # Print numbers 1 to 10 with distance print() # Going to the next line # Multiplication table printing for i in range(1, 11): for j in range(1, 11): print(f"{i * j:2}", end=" ") # The calculation and printing of the multiplication print() # Go to the next line after each row # Implementation of the function print_multiplication_table()
Submitting answers is currently unavailable.
Write a program that receives any professors including name, age and city from the entrance.
Write a function that receives a numeric and if that number was the first number True and otherwise False returned
The program receives the amount of distance traveled to kilometers and the amount of fuel consumed in liter and prints according to the following instructions, whether the car is low or high. If the fuel consumption of this car is less than 7 liters ...
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نام If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.