Assume that the int variables i and j have been
declared, and that n has been declared and initialized.
Write code that causes a "triangle" of asterisks of size
n to be output to the screen. Specifically, n lines should
be printed out, the first consisting of a single asterisk,
the second consisting of two asterisks, the third
consistings of three, etc. The last line should consist of
n asterisks. Thus, for example, if n has value 3, the
output of your code should be
*
**
***
You should not output any space characters.
Hint: Use a for loop nested inside another for loop.
Answers were Sorted based on User's Feedback
Answer / sreepal
#include<stdio.h>
main()
{
int i,j,n;
printf("Enter the size of Triangle:");
scanf("%d", &n);
for(i=0;i<n;i++)
{
for(j=0;j<=i;j++)
{
printf("*");
}
printf("\n");
}
}
| Is This Answer Correct ? | 9 Yes | 4 No |
Why are memory errors hard to debug?
A sample program using data structure? what is file handling?
char* f() return "hello:"; void main() {char *str=f(); }
void main() { int i=7; printf("N= %*d",i,i); }
Write a C program to enter 10 integer numbers through one variable and count how many of them are even using while loop ?
quoroum of computer languages?
Answering Yes or No in C++...using only stdio.h and conio.h..........help me please...? here's must be the output of the program: Screen A Exam No. items Score 1 20 20 2 35 35 Another Entry? [Y] or [N] : Screen B: Record No. Student's Name: 1 Fernando Torres 2 Chuck Norris Note: if you press Y, the program must repeat the procedure in screen A, then if N, the program must proceed to the screen B....Please Help me out............
what is meant by linking error? how can i solve it? if there is a linking error " unable to open file 'cos.obj'? then what should i do?
what is meant for variable not found?
Write a program to accept two strings of Odd lengths. Then take all odd characters from one string and even characters from the other and concatenate and produce a string.
How to reverse a linked list without using array & -1? Thank you.
Using string functions write a program that will accept the name of the capital as input value and will display the corresponding country. ------------------------ Capitals Countries ------------------------ Capitals Countries Ottawa Canada Moscow Russia Rome Italy I can't not get it to run properly