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

What is indirection?

0 Answers  


What is unary operator?

0 Answers  


can we store values and addresses in the same array? explain

3 Answers   TCS,


9.how do you write a function that takes a variable number of arguments? What is the prototype of printf () function? 10.How do you access command-line arguments? 11.what does ‘#include<stdio.h>’ mean? 12.what is the difference between #include<> and #include”…”? 13.what are # pragma staments? 14.what is the most appropriate way to write a multi-statement macro?

4 Answers   L&T,


List the different types of c tokens?

0 Answers  






what is const volatile?

2 Answers  


Why do we use & in c?

0 Answers  


Tell us the use of fflush() function in c language?

0 Answers  


a=5 a=a++/++a

14 Answers   Bhel,


write a sorting prgm to sort 50 nos and sum them and also remove all the occurrences of 15 and print it?

0 Answers  


Read the following data in two different files File A: aaaaaaaadddddddd bbbbbbbbeeeeeeee ccccccccffffffff File B: 11111111 22222222 33333333 By using the above files print the following output or write it in the Other file as follows aaaaaaaa11111111dddddddd bbbbbbbb22222222eeeeeeee cccccccc33333333ffffffffffff

0 Answers  


How can we allocate array or structure bigger than 64kb?

2 Answers   CSC,


Categories