Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.

Answers were Sorted based on User's Feedback



Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use ..

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

Write a Program to print this triangle: * ** * **** * ****** * ******** * ********** use ..

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

Post New Answer

More C Interview Questions

how to print electricity bill according to following charges first 100 units -1rs per unit for next 200 units-1.50 rs per unit without using conditions

0 Answers  


Where does the name "C" come from, anyway?

0 Answers   Celstream,


what is difference between strcmp & palindrome?

3 Answers  


Find if a number is power of two or not?

1 Answers  


#define DCHAR char* typedef char* TCHAR; if using these following variables will be declared like DCHAR ch1, ch2; TCHAR ch3, ch4; then what will be types of ch1, ch2, ch3 and ch4?

6 Answers   NDS,


What is period operator in c?

3 Answers   Wipro,


What is the Purpose of 'extern' keyword in a function declaration?

0 Answers  


what is the most appropriate way to write a multi-statement macro?

1 Answers  


what is output of the following statetment?Printf(“%x”, -1<<4); ?

5 Answers  


related to rdbms query .

2 Answers  


write aprogram for There is a mobile keypad with numbers 0-9 and alphabets on it. take input of 7 keys and then form a word from the alphabets present on those keys.

1 Answers   iGate, Shashi, Source Bits, Subex,


write a program in reverse the string without using pointer,array,global variable declaration,lib fun only using a function?

5 Answers   HCL,


Categories