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
What is meant by realloc()?
What is the benefit of using an enum rather than a #define constant?
What is function what are the types of function?
how to find anagram without using string functions using only loops in c programming
What is structure padding and packing in c?
What is a method in c?
What is a static function in c?
What is the code in while loop that returns the output of given code?
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
Explain how can a program be made to print the name of a source file where an error occurs?
Explain the priority queues?
What are the output(s) for the following ? #include char *f() {char *s=malloc(8); strcpy(s,"goodbye")} main() { char *f(); printf("%c",*f()='A'); }
What are loops in c?
What is wrong with this code?
How to implement a packet in C