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
How many keywords are there in c?
Why does not c have an exponentiation operator?
Explain how can a program be made to print the line number where an error occurs?
Explain modulus operator.
Given below are three different ways to print the character for ASCII code 88. Which is the correct way1) char c = 88; cout << c << " ";2) cout.put(88);3) cout << char(88) << " "; a) 1 b) 2 c) 3 d) constant
What is difference between Structure and Unions?
In which header file is the null macro defined?
Write a code of a general series where the next element is the sum of last k terms.
What is the purpose of sprintf() function?
Is int a keyword in c?
What is data structure in c programming?
Explain is it better to bitshift a value than to multiply by 2?
if the area was hit by a virus and so the decrease in the population because of death was x/3 and the migration from other places increased a population by 2x then annually it had so many ppl. find our the population in the starting.
What are the different types of data structures in c?
Is malloc memset faster than calloc?