Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answer Posted / 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 |
Post New Answer View All Answers
What are the different types of linkage exist in c?
In a switch statement, explain what will happen if a break statement is omitted?
What is #define in c?
Can we increase size of array in c?
Give differences between - new and malloc() , delete and free() ?
What is the use of header files?
Explain what are reserved words?
a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f
What is a rvalue?
Can the size of an array be declared at runtime?
what is a NULL Pointer? Whether it is same as an uninitialized pointer?
What is the difference between a function and a method in c?
What is typedef?
Why array is used in c?
Explain heap and queue.