a Slight change to the previous program Here it goes ....
#include<stdio.h>
int main()
{
int i,j,n;
printf("\n Enter the value of n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=n-i;j++)
printf(" ");
for(j=1;j<=i;j++)
printf(" ""*");
printf("\n");
}
for(i=1;i<=n;i++)
{ for(j=1;j<=i;j++)
printf(" ");
for(j=1;j<=(n-i);j++)
printf(" ""*");
printf("\n");
}
return 0;
}
o/p
*
* *
* * *
* * * *
* * *
* *
*
On Sun, Jul 31, 2011 at 3:41 PM, rajeev bharshetty <[email protected]>wrote:
> #include<stdio.h>
> int main()
> {
> int i,j,n;
> printf("\n Enter the value of n");
> scanf("%d",&n);
> for(i=1;i<=n;i++)
> {
> for(j=1;j<=n-i;j++)
> printf(" ");
> for(j=1;j<=i;j++)
> printf("*");
> printf("\n");
> }
> for(i=1;i<=n;i++)
> { for(j=1;j<=i;j++)
> printf(" ");
> for(j=1;j<=n-i;j++)
> printf("*");
> printf("\n");
> }
>
>
> return 0;
> }
>
>
>
> On Sun, Jul 31, 2011 at 2:37 PM, Someshwar Chandrasekaran <
> [email protected]> wrote:
>
>> On Sun, Jul 31, 2011 at 2:20 PM, priyanka raju <[email protected]>
>> wrote:
>> > write a c program to print the following
>> >
>> > *
>> > * *
>> > * * *
>> > * *
>> > *
>>
>> What complexity is expected?
>>
>> Regards,
>> B.C.Someshwar
>>
>>
>> --
>> 'Talk sense to a fool and he calls you foolish.' - Euripides
>>
>> My Blog: somsekaran.wordpress.com
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>>
>
>
> --
> Regards
> Rajeev N B <http://www.opensourcemania.co.cc>
>
> "*Winners Don't do Different things , they do things Differently"*
>
>
--
Regards
Rajeev N B <http://www.opensourcemania.co.cc>
"*Winners Don't do Different things , they do things Differently"*
--
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/algogeeks?hl=en.