0

what is the program of do while that ...
you can type any number but when u type zero it will stop the program?
thanks for the help
peace!

2
Contributors
7
Replies
9
Views
6 Years
Discussion Span
Last Post by CloudZELL91
0

yes, narue maybe you right am lazy...am still new on this....

main()

{int  x=1

   do{ printf("%d",x);
         x++;
           if(x==0),
             {
                printf("end") 
              }
        }while(x>0)

,,,,,,
is this right?

Edited by Dani: Formatting fixed

-1

You sound incredibly lazy. Seeing as this is a trivial program, try it yourself first.

yes, narue maybe you right am lazy...am still new on this....

is my program right? the one i post?

0

Replace ++x; with scanf("%d", &x); and your logic is reasonably sound. Otherwise it's broken because the loop will never end[1].


[1] It will end, but not in a well-defined way.

0

[1]....
main()

{int x=1

do{ printf("%d",x);
scanf("%d", &x);
if(x==0),
{
printf("end")
}
}while(x>0)

...

[2]
main()

{
scanf("%d", &x);

int x=1;

do{ printf("%d",x);
x++;
if(x==0),
{
printf("end")
}
}while(x>0)

,,,,,

the program will be shown like you said in the number one....
but if i do it like in the number 2...is it also right?

0

but if i do it like in the number 2...is it also right?

No. Might I recommend dropping down a level and learning basic programming through pseudocode? Your C is just awful, and not understanding the the fundamentals won't help.

0

No. Might I recommend dropping down a level and learning basic programming through pseudocode? Your C is just awful, and not understanding the the fundamentals won't help.

hehehe..yes narue your right am really awful in c coz i skip c programming for atleast a year and i forgot everything and now am doing it again haha...
so thats it thanks a lot man,, for your time....
,,,,i'll just use the program that u gave...
peace!

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.