Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answers were Sorted based on User's Feedback
Answer / manoj
void main() {
int n = 5 ; // take use input here
int i, j;
for( i =1; i<=n; i++){
printf("\n *");
for(j=1; j<i; j++){
printf(" *");
}
}
}
| Is This Answer Correct ? | 8 Yes | 13 No |
Answer / vikram sharma
<?php
for($i=0;$i<10;$i++){
for($j=0;$j<=$i;$j++){
if($i%2!=0 || $i==0 || $j==1)
echo"*";
}
echo"</br>";
}
?>
| Is This Answer Correct ? | 7 Yes | 12 No |
What is the use of volatile?
What is I ++ in c programming?
Whats wrong with the following function char *string() { char *text[20]; strcpy(text,"Hello world"); return text; }
If errno contains a nonzero number, is there an error?
main() { int x, arr[8]={11,22,33,44,55,66,77,88}; x=(arr+2)[3]; printf(ā%dā,x); }
I was asked to write a program in c which when executed displays how many no.of clients are connected to the server.
Is it possible to use curly brackets ({}) to enclose single line code in c program?
When should I declare a function?
Can a variable be both static and volatile in c?
Explain which function in c can be used to append a string to another string?
How do you print only part of a string?
Write a program to print factorial of given number using recursion?