Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / rfk
#include<stdio.h>
int main()
{
int n,i,j;
printf("enter the lines :");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("*\n");
for(j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");
}
compiled with GCC
| Is This Answer Correct ? | 13 Yes | 7 No |
Post New Answer View All Answers
.find the output of the following program? char*myfunc(char*ptr) { ptr +=3; return (ptr); } int main() { char*x,*y; x="HELLO"; y=myfunc(x); printf("y = %s ",y); return 0; }
What is the difference between c and python?
what is the differnce between programing langauge and tool? is sas is a programing langauge r tool?
Differentiate fundamental data types and derived data types in C.
In c programming write a program that will print 10 multiples of 3 except 15,18,21 using looping
What is variable in c example?
How can you avoid including a header more than once?
What is the explanation for the dangling pointer in c?
can we implement multi-threads in c.
What is a null pointer in c?
Write a C program to count the number of email on text
What is difference between arrays and pointers?
What are the advantages of c language?
Explain bitwise shift operators?
what is the c source code for the below output? 5555555555 4444 4444 333 333 22 22 1 1 22 22 333 333 4444 4444 5555555555