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 / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the lines :");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("%d",j);
printf("\n");
}
if(n%2!=0)
printf("\n*");
getch();
}

thank u

Is This Answer Correct ?    54 Yes 29 No

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

Answer / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int n;
printf("enter the lines :");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");
getch();
}

Is This Answer Correct ?    29 Yes 11 No

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

Answer / srinivas 9491582281

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

Is This Answer Correct ?    15 Yes 7 No

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

Answer / rfk

#include<stdio.h>
int main()
{
int n,i,j;
printf("enter the lines :");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("*\n");
for(j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");

}

compiled with GCC

Is This Answer Correct ?    13 Yes 7 No

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

Answer / umesh shinde

#include<stdio.h>
int main()
{
int n,i,j;
printf("enter the lines :");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("*\n");
for(j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");

}

Is This Answer Correct ?    8 Yes 5 No

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

Answer / prasanna

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
printf("enter the lines:");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("/n");
for(j=1;j<=2*i;j++)
printf("\n");
}
if(n%2!=0);
printf("\n");
getch();
}

Is This Answer Correct ?    10 Yes 8 No

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

Answer / naman patidar

void main() {
int n = 5 ; // take use input here
int i, j;
for( i =1; i<=n; i++){
printf("\n *");
for(j=0; j<=i; j++){
printf(" *");
}
}
}

Is This Answer Correct ?    23 Yes 22 No

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

Answer / kk

only 1st quistion is correct and then all ar quistions are
wrong.

Is This Answer Correct ?    1 Yes 0 No

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

Answer / adhiraj keshri

#include<stdio.h>
main()
{
int n;
printf("enter the lines");
scanf("%d",&n);
for(int i=1;i<=n/2;i++)
{
printf("*\n");
for(int j=1;j<=2*i;j++)
printf("*");
printf("\n");
}
if(n%2!=0)
printf("\n*");

}

Is This Answer Correct ?    4 Yes 5 No

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

Answer / abdi

#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,j;
printf("enter the lines:");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
printf("/n");
for(j=1;j<=2*i;j++)
printf("\n");
}
if(n%2!=0);
printf("\n");
getch();
}

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More C Interview Questions

define string ?

0 Answers  


main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }

3 Answers   ME,


hi folks i m approching for h1 b interview on monday 8th of august at montreal and i m having little problem in my approval notice abt my bithdate my employer has made a mistake while applying it is 12th january and istead of that he had done 18 the of january do any body have any solution for that if yes how can i prove my visa officer abt my real birthdate it urgent please let me know guys thaks dipesh patel

0 Answers  


How can you check to see whether a symbol is defined?

0 Answers  


write a c program for greatest of three numbers without using if statment

4 Answers   IBM,






How can I sort more data than will fit in memory?

0 Answers  


What is indirection?

0 Answers  


Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?

1 Answers  


what does static variable mean?

0 Answers   TCS,


Program to find the sum of digits of a given number until the sum becomes a single digit. (e.g. 12345=>1+2+3+4+5=15=>1+5=6)

0 Answers   InterGraph,


What is mean by data types in c?

0 Answers  


Linked list is a Linear or non linear explain if linear how it working as a non linear data structures

0 Answers  


Categories