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 |
void main() { int i=5,y=3,z=2,ans; clrscr(); printf("%d",++i + --z + i++ + --i * ++y); i=5,y=3,z=2; ans=++i + --z + i++ + --i * ++y; printf("\n%d",ans); getch(); } Its output is 37 and 31.... Please explain me why its different How it works.....
Write a c-programe that input one number of four digits and find digits sum?
Write down the difference between c. Loop and goto statement d. (!0) and (!1) e. (1= =! 1) and (1!=1) f. NULL and !NULL
WHAT WILL BE THE OUTPUT OF THE FOLLOWING QUESTION void main() { int x=4,y=3,z; z=x-- -y; printf("%d%d%d",x,y,z); }
void main() { int i=5; printf("%d",i+++++i); }
how to convert decimal to hexadecimal without using arrays just loops
#include<stdio.h> void main() { int i=1; printf("%d%d%d",i++,++i,i); }
Find the error (2.5*2=5) (a) X=y=z=0.5,2.0-5.75 (b) s=15;
errors are known as?
3 Answers EX, State Bank Of India SBI,
main() { char c; for(c='A';c<='Z';c++) getch(); }
How to create a program that lists the capital country when told what the original country is? (Terribly sorry, I'm a novice programmer and would appreciate any help ;). Cheers, Alexxis
what is the large sustained error signal that eventually cause the controller output to drive to its limit