Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / vignesh1988i
#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the lines :");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("%d",j);
printf("\n");
}
if(n%2!=0)
printf("\n*");
getch();
}
thank u
| Is This Answer Correct ? | 54 Yes | 29 No |
Post New Answer View All Answers
How is = symbol different from == symbol in c programming?
Where are the auto variables stored?
Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
What type of function is main ()?
What are the similarities between c and c++?
Which is an example of a structural homology?
Difference between exit() and _exit() function?
Is c is a middle level language?
Explain how do you override a defined macro?
How to Throw some light on the splay trees?
Can we change the value of #define in c?
Is main is a keyword in c?
What is self-referential structure in c programming?
Mention four important string handling functions in c languages .