{[['']]}
[PROGRAMS]
C Program To display the triangle using *, numbers and character
Write a C Program to print half pyramid as using * as shown in figure below.
*
* *
* * *
* * * *
* * * * *
Answer:
----------------------------------------------------------------
#include <stdio.h>
int main() {
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i) {
for(j=1;j<=i;++j) {
printf("* ");
}
printf("\n");
}
return 0;
}
----------------------------------------------------------------
2. C++ programming
3. Java programming
4. PHP programming
5. Pearl programing
C Program To display the triangle using *, numbers and character
Write a C Program to print half pyramid as using * as shown in figure below.
*
* *
* * *
* * * *
* * * * *
Answer:
----------------------------------------------------------------
#include <stdio.h>
int main() {
int i,j,rows;
printf("Enter the number of rows: ");
scanf("%d",&rows);
for(i=1;i<=rows;++i) {
for(j=1;j<=i;++j) {
printf("* ");
}
printf("\n");
}
return 0;
}
----------------------------------------------------------------
2. C++ programming
3. Java programming
4. PHP programming
5. Pearl programing
Post a Comment