0
Program by while fn
* ** *** **** ***** ******
9 Antworten
+ 1
hope this will help
#include<stdio.h>
int main()
{
int i,j,n;
printf("Enter how many rows you want: \n");
scanf("%d",&n);
i=1;
while(i<=n)
{ j=1;
while(j<= n-i){
printf(" ");
j++;}
j=1;
while(j<=i){
printf("*");
j++;}printf("\n");
i++;}
return 0;
}
0
what is your problem?
0
I want to print above pattern using while
0
Thank you
If you ans it for Python
It will be more helpful for me
There are 5 lines
0
This is the python code
num = int(input("Enter the range: \t \n"))
# i loop for range(height) of the triangle
# first j loop for printing space ' '
# second j loop for printing stars '*'
i=0
while i <(num):
j=0
while j <((num - i) - 1):
print(end=" ")
j=j+1
j=0
while j <(i + 1):
print("*", end=" ")
j=j+1
i=i+1
print()
0
No.
I want to print in the form if equilateral triangle in this ∆ form
0
i=1
while i<=5:
j=1
while j<=5-i:
print(" ",end="")
j=j+1
j=1
while j<=i*2:
print("*",end="")
j=j+1
i=i+1
print()
0
But i unable to print 1st one
0
it print any number you want. i am sure it work.