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
Why void main is used in c?
Explain what is wrong in this statement?
What is a structure in c language. how to initialise a structure in c?
What are the storage classes in C?
Explain what are binary trees?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
how to introdu5ce my self in serco
write a program that reads lines(using getline), converts each line to an integer using atoi, and computes the average of all the numbers read. also compute the standard deviation.
Explain what are preprocessor directives?
Why calloc is better than malloc?
What is the use of header?
When should the const modifier be used?
Explain what is #line used for?
What is data structure in c and its types?
If I have a char * variable pointing to the name of a function ..