Write a program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
Don't use printf statements;use two nested loops instead.
you will have to use braces around the body of the outer
loop if it contains multiple statements.

Answers were Sorted based on User's Feedback



Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / dhanashree n.gavade

int i,j,m;
m=2;
for(i=0;i<5,i++)
{
putch('*');
putch('\n');
for(j=i;j<=j+m;j++)
putch('*');
m=j;
putch('\n');
}

Is This Answer Correct ?    15 Yes 6 No

Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / rakesh

#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=10;i++){
if(i%2!=0)
printf("*\n");
else{
for(j=0;j<i;j++)
printf("*");
printf("\n");
}
}
return 0;
}

Is This Answer Correct ?    3 Yes 2 No

Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / gana

{
int a,b=2,i;
char *s="\0";
for(i=0;i<5;i++)
{
for(a=0;a<5-i;a++)
putch(' ');
for(a=0;a<b;a++)
putch('*');
b+=2;
puts(s);
}
}

Is This Answer Correct ?    1 Yes 0 No

Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / reshma m.

int i,j,m;
m=2;
for(i=0;i<5;i++)
{putch('*');
putch('\n');
for(j=0;j<m;j++)
{putch('*');
m+=2;
}
putch('\n');
}

Is This Answer Correct ?    4 Yes 5 No

Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / yk humble

5 cls
10 rem to print triangle

Is This Answer Correct ?    0 Yes 1 No

Write a program to print this triangle: * ** * **** * ****** * ******** * ********** Don&..

Answer / rakesh

#include<stdio.h>
int main()
{
int i,j;
for(i=1;i<=10;i++){
if(i%2!=0)
{
putchar('*');
putchar('\n');
}
else{
for(j=0;j<i;j++)
putchar('*');
putchar('\n');
}
}
return 0;
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Interview Questions

struct tag{ auto int x; static int y; };main() { struct tag s; s.x=4; s.y=5; printf(ā€œ%dā€,s.x); }

2 Answers   Vector,


Why does everyone say not to use gets?

0 Answers  


Why use int main instead of void main?

0 Answers  


How can I do serial ("comm") port I/O?

0 Answers   Celstream,


What are local variables c?

0 Answers  






write a program in c language for the multiplication of two matrices using pointers?

8 Answers   Ignou,


write a program that explain #define and # undef directive

1 Answers  


f() { int a=2; f1(a++); } f1(int c) { printf("%d", c); } c=?

7 Answers   Geometric Software,


What is a structural principle?

0 Answers  


Write a C program to find the smallest of three integers, without using any of the comparision operators.

7 Answers   TCS,


what is difference between procedural language and functional language ?

4 Answers   Wipro,


What is an anonymous union and where to apply that ?

3 Answers   HP,


Categories