English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

hey guyz.. please do help me to program this using for loop in turbo C.

1.
*
**
***
****
*****

this would be the output.. wht are the codes?

2006-09-01 17:40:00 · 6 answers · asked by chechel 1 in Computers & Internet Programming & Design

6 answers

# include
int i,j;
main()
{
for (i=0; i<=5; i++)
{
for (j=i; j>0; j--)
printf ("*");
printf("\n");
}
getch();
return 0;
}

2006-09-01 19:39:55 · answer #1 · answered by hanybakir 1 · 0 1

Try the flowing code in the Turbo C window

# include
int i,j;
main()
{
clrscr();
printf ("The Stars");
for (i=0; i<=5; i++)
{
for (j=i; j>0; j--)
printf ("*");
printf("\n");
}
getch();
return 0;
}

2006-09-01 19:19:20 · answer #2 · answered by Nishan Saliya 4 · 0 0

i=0;
j-0;
a ="*";
for i=0; i<5; i++
{for j=0; j {print a } }

Note: above is the psuedo code

2006-09-01 17:45:00 · answer #3 · answered by chharsha 3 · 1 0

#include
using namespace std;

int main(){
for(int c=1;c<6;c++){
for(int n=c;n>0;n--){
cout<<'*';
}
cout<<'\n';
}
return 0;
}

2006-09-01 17:46:41 · answer #4 · answered by ion599 1 · 0 0

# include
int i,j,x;
main()
{
clrscr();
printf ("enter number of blah blah");
scanf("%d", &x);
for (i=0; i<=x; i++)
{
for (j=i; j>0; j--)
printf ("*");
printf("\n");
}
getch();
return 0;
}

2006-09-03 23:59:44 · answer #5 · answered by bryan 2 · 0 0

cout is c++ -- LOL
try:
printf("+"); //do n times

2006-09-01 17:49:53 · answer #6 · answered by ★Greed★ 7 · 0 0

fedest.com, questions and answers