hi friends,

First I want to introduce myselt, I am Aditya and have little knowledge of programming because I have enter in this field just os i face problem with c and need your kind solution, your reply would much valueabel for my bright future...

I have a problem in looping, actually i want to get printed like
*
***
*****
*******
*********
but i fail to print it in C.

give some idea.

We don't give away free homework here. Post the code that's you've made and tell us what's wrong with it.
When you show that you've put some effort in it, you'll get help!

That was a good one but unfortunately we don't offer help at such a general level more so when you don't show any effort. Just show us a little bit of code that you have written and we might help you!
Ronny

Tell you guys a joke. I know a friend who gave the below answer to a similar programming assignment:

printf("*\n");
printf("***\n");
printf("*****\n");
printf("*******\n");
printf("*********\n");

Good idea. Optimized solution (to have a star easely, faster with factor 10 or more):

printf(
"*\n"
"***\n"
"*****\n"
"*******\n"
"*********\n"
);

Premium edition for lazy programmers...

Or if you want to type in even less characters:

printf("*\n***\n******\n*******\n*********\n");

I typed 8 characters less (double quotes) and saved myself up to 3 seconds of time :)

LoL! I can help. But won't if you don't try something yourself.

Show us some of your codes. Or any idea that you have! =)

Or if you want to type in even less characters:

printf("*\n***\n******\n*******\n*********\n");

I typed 8 characters less (double quotes) and saved myself up to 3 seconds of time :)

Hmm .. or even less

puts("*\n***\n******\n*******\n*********");

following code will surely solve your problem

#include <stdio.h>
#include <conio.h>

void main()
{
 int i,j;
 clrscr();
 /*change value of of 'i' & get as much stars u want*/
 for(i=1;i<8;i=i+2)
 {
  printf("\n\n");
  for(j=0;j<i;j++)
  {
   printf("*");
  }
 }
 getch();
}
commented: Giving the answer to people is frowned upon. They learn nothing. It's better to HELP them solve it. -3
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.