Re: how do I run this program?

Top Page
Attachments:
Message as email
+ (text/plain)
+ junk.c (text/x-c)
+ (text/plain)
Delete this message
Reply to this message
Author: kitepilot@kitepilot.com
Date:  
To: Main PLUG discussion list
Subject: Re: how do I run this program?
Michael Havens writes:

> I need to get every four digit combination as part of the next challenge in
> bandit. I'm not a programmer so I googled for a solution. Please, how do I
> run this program?
>
> int main(int argc, char** argv){
> int a,b,c,d;
>
> for(a=1; a<5; a++){
> for(b=1; b<5; b++){
> for(c=1; c<5; c++){
> for(d=1; d<5; d++){
> if(!(a==b || a==c || a==d || b==c || b==d || c==d))
> printf("%d%d%d%d
> ",a,b,c,d);
> }
> }
> }
> }
>
> return 0;
> }
> :-)~MIKE~(-:

/* Compile and execute with:
cc -o junk junk.c
./junk
*/

#include "stdio.h"

int main(int argc, char** argv){
    int a,b,c,d;


    for(a=1; a<5; a++){
        for(b=1; b<5; b++){
            for(c=1; c<5; c++){
                for(d=1; d<5; d++){
                    if(!(a==b || a==c || a==d || b==c || b==d || c==d))
                        printf("%d%d%d%d\n",a,b,c,d);
                }
            }
        }
    }


    return 0;
}
/*END*/

---------------------------------------------------
PLUG-discuss mailing list -
To subscribe, unsubscribe, or to change your mail settings:
http://lists.phxlinux.org/mailman/listinfo/plug-discuss