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

What is extern keyword in c?

0 Answers  


what are non standard function in c

0 Answers  


Write a C/C++ program that connects to a MySQL server and checks if the InnoDB plug-in is installed on it. If so, your program should print the maximum number of concurrent threads that the InnoDB plug-in can create.

0 Answers   IBM,


Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

0 Answers  


Why cd or dvd are round why not square.

1 Answers  


What are global variables?

0 Answers  


What is the difference between ++a and a++?

0 Answers  


Write a C program to get the desired output. 1 1 2 1 1 3 3 1 1 4 6 4 1 1 5 10 10 5 1 . . . 1 n..............n 1 Note: n is a positive integer entered by the user.

4 Answers  


Hello. How to write a C program to check and display president party like if i type in the console "biden" and hit enter the output shoud be : "biden is democrat" and if i type "trump" and hit enter the output shoud be: "trump is republican"

0 Answers  


How do I round numbers?

0 Answers  


what is the output on the screen? int n; n=printf("my name is %d",printf("kiran %d",printf("kumar"))); printf("\n %d \n",n);

4 Answers   TCS,


Why data types in all programming languages have some range? Why ritche have disigned first time likethat?Why not a single data type can support all other types?

2 Answers   Excel,


Categories