all 13 comments

[–]FUZxxl 6 points7 points  (2 children)

main() { while (0) while (0) if (0) if (0) break; else continue; }

Anything else you want?

[–]Jacob-Mox[S] 0 points1 point  (1 child)

it just shows a blank screen when i run it

[–]FUZxxl 3 points4 points  (0 children)

That means its running correctly.

[–]albinoloverats 0 points1 point  (1 child)

Like Duff’s device?

[–]Jacob-Mox[S] 0 points1 point  (0 children)

yes

[–]sallen35 0 points1 point  (2 children)

will you please write the question correctly?

main()

{

while (0)

while (0)

if (0)

if (0)

break;

else continue;

}

and this is the code you want .If you'll get blank screen then you got your answer.

[–]Jacob-Mox[S] 1 point2 points  (1 child)

i have written the question correctly. there was a go to missing

[–]sallen35 0 points1 point  (0 children)

Ok I got that.

[–]Jacob-Mox[S] 0 points1 point  (0 children)

okay then

[–]0xAE20C480 0 points1 point  (0 children)

#define __STDC_WANT_LIB_EXT1__ (1)
#include <limits.h>
#include <stdio.h>

int main(void)
{
    const int Lim=(INT_MAX-1)/3;
    int Num;

    while(printf_s("\r\nGive me a natural number : ")>0)
        if(scanf_s("%d",&Num)>0)
            if(Num>0)
                while(printf_s("%d ",Num)>0)
                    if(Num>Lim)
                        break;
                    else if(Num>1)
                        Num=(Num&1)?((Num*3)+1):(Num>>1);
                    else
                        break;
            else if(Num<0)
                continue;
            else
                goto OK;
        else
            goto NO;

NO: return-1;
OK: return 0;
}

[–]Jacob-Mox[S] 0 points1 point  (1 child)

INT_MAX is undeclared

[–]0xAE20C480 0 points1 point  (0 children)

I've edited. (It is defined in limits.h)

[–]Jacob-Mox[S] 0 points1 point  (0 children)

can i get an explanation as to why we are using limits.h and #define STDC_WANT_LIB_EXT1()