+ 1

How to make upper triangle pattern of prime number in python

1 2 3 5 7 11 13 17 19 23

1st Dec 2019, 5:40 PM
Manish Choudhary
Manish Choudhary - avatar
2 Antworten
+ 4
Think logic and Try to do self.
1st Dec 2019, 5:44 PM
A͢J
A͢J - avatar
+ 1
#PSEUDO CODE: bool isPrime(int n) for (i = 2; i <= n / 2; i++) if (n%i == 0) return false return true __main__ n, i = 4, 2 for (r = 0; r < n; r++) #like given pattern print(spaces) for (c = r; c < n; i++) if (isPrime(i)) print(i) c++ print(\n) # try to implement on your own.
1st Dec 2019, 6:13 PM
RKK
RKK - avatar