freelanceprogrammers.org Forum Index » C

Solve this Query.....


View user's profile Post To page top
krishna_sicsr Posted: Tue Feb 01, 2005 1:09 pm


Joined: 01 Feb 2005

Posts: 2
Solve this Query.....
hello friends,
i have a problem that my one friend has given me a statement

main()
{
int i,n=20;
for(i=0;i<n;i--)
{
cout<<"-";
}
}

u have to print this sign (-) 20 times with only one changes in the
above problem

thanks.....
Reply with quote
Send private message
View user's profile Post To page top
btech_it Posted: Thu Feb 03, 2005 11:22 pm


Joined: 03 Feb 2005

Posts: 1
Solve this Query.....
Hi Krishna

this sign (-) can be printed by changing "i--" in the loop to "i++".

So, this will be the final code..........

main()
{
int i,n=20;
for(i=0;i<n;i++)
{
cout<<"-";
}
}

jasmeet


--- In Programmers-Town@yahoogroups.com, "krishna_sicsr"
<krishna_sicsr@y...> wrote:
>
>
> hello friends,
> i have a problem that my one friend has given me a
statement
>
> main()
> {
> int i,n=20;
> for(i=0;i<n;i--)
> {
> cout<<"-";
> }
> }
>
> u have to print this sign (-) 20 times with only one changes in
the
> above problem
>
> thanks.....
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
China Wholesale - Electronics Products
Character Studio - Tutorials and Help