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

What do you mean by invalid pointer arithmetic?

0 Answers  


1. Write a c pgm to print 1 to 100 without using loops. 2. Write a c pgm for leap year 3. Write a c pgm fibbonacci series,factorial 4. Write a c pgm count no of lines , blanks, tabs in a para(File concept) 5. Write a c pgm to print the letter as per given condition i.e.. if u give 4 out put should b 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 4 6.how do get the o/p in number from 1 to 100 in the screen without using control statement? 7. who do u print the word "hello world" without using "printf" statement? 8. write sql program to get the detail of student in a class? Definitions: structure union arrays linkedlist macros directives difference b/w pre processorsDiffrence: 1.Constructors and destructors 2.Structure and Union 3.Array and Lists 4.pre processor... 5. Privillages in C++ 6.structure and union 7.break and continue 8.while and dowhile Pgm..

3 Answers  


What is this infamous null pointer, anyway?

0 Answers  


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

0 Answers   Wipro,


how to connect oracle in C/C++.

3 Answers   TCS, Wipro,






What is pass by reference in c?

0 Answers  


Why is sprintf unsafe?

0 Answers  


will the program compile? int i; scanf(ā€œ%dā€,i); printf(ā€œ%dā€,i);

3 Answers  


write a program to fined second smallest and largest element in a given series of elements (without sorting)

9 Answers   Yahoo,


What does void main return?

0 Answers  


Expand the following LKB BKL FFG

0 Answers  


Write a program to generate a pulse width frequency of your choise,which can be variable by using the digital port of your processor

0 Answers   TATA, TCS,


Categories