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 will be the outcome of the following conditional statement if the value of variable s is 10?

0 Answers  


What is string function c?

0 Answers  


let's take a code struct FAQ { int a; char b; float c; double d; int a[10]; }*temp; now explain me how the memory will be allocated for the structure FAQ and what address will be in the structure pointer (temp)....................

8 Answers  


program to print circle structure

1 Answers  


How to implement call back functions ?

3 Answers   HP,






What are the different types of control structures in programming?

0 Answers  


main() { enum{red,green,blue=6,white}; pf("%d%d%d%d", red,green,blue,white); return 0; } a)0 1 6 2 b)0 1 6 7 c)Compilation error d)None of the above

6 Answers  


Write a C program to print 1 2 3 ... 100 without using loops?

15 Answers   Hindalco,


Give a method to count the number of ones in a 32 bit number?

4 Answers  


write an interactive C program that will encode or decode a line of text.To encode a line of text,proceed as follows. 1.convert each character,including blank spaces,to its ASCII equivalent. 2.Generate a positive random integer.add this integer to the ASCII equivalent of each character.The same random integer will be used for the entire line of text. 3.Suppose that N1 represents the lowest permissible value in the ASCII code,and N2 represents the highest permissible value.If the number obtained in step 2 above(i.e.,the original ASCII equivalent plus the random integer)exceeds N2,then subtract the largest possible multiple of N2 from this number,and add the remainder to N1.Hence the encoded number will always fall between N1 and N2,and will therefore always represent some ASCII character. 4.Dislay the characters that correspond to the encoded ASCII values.  The procedure is reversed when decoding a line of text.Be certain,however,that the same random number is used in decodingas was used in encoding.

0 Answers  


What is a MAC Address?

0 Answers  


How is pointer initialized in c?

0 Answers  


Categories