Write a Program to print this triangle:
*
**
*
****
*
******
*
********
*
**********
use two nested loops.
Answers were Sorted based on User's Feedback
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 |
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 |
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 |
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 |
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 |
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 |
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 |
Answer / kk
only 1st quistion is correct and then all ar quistions are
wrong.
Is This Answer Correct ? | 1 Yes | 0 No |
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 |
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 |
define string ?
main() { int i=1; while (i<=5) { printf("%d",i); if (i>2) goto here; i++; } } fun() { here: printf("PP"); }
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
How can you check to see whether a symbol is defined?
write a c program for greatest of three numbers without using if statment
How can I sort more data than will fit in memory?
What is indirection?
Explain what?s happening in the first constructor: public class c{ public c(string a) : this() {;}; public c() {;} } How is this construct useful?
what does static variable mean?
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)
What is mean by data types in c?
Linked list is a Linear or non linear explain if linear how it working as a non linear data structures