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
What is the incorrect operator form following list(== , <> , >= , <=) and what is the reason for the answer?
Explain do array subscripts always start with zero?
What is a structural principle?
Give basis knowledge of web designing ...
What are the 5 elements of structure?
Explain the array representation of a binary tree in C.
What is New modifiers?
The performance of an operation in several steps with each step using the output of the preceding step a) recursion b) search c) call by value d) call by reference
How to compare array with pointer in c?
If you know then define #pragma?
Why can't I perform arithmetic on a void* pointer?
How do you list a file’s date and time?
What is an auto keyword in c?
How do you print only part of a string?
c language interview questions & answer