Two-color balls written in C language and two-color balls written in C Language

Source: Internet
Author: User

Two-color balls written in C language and two-color balls written in C Language

# Include <stdio. h>

# Include <stdlib. h>

# Include <time. h>

Double jieguo ();

Void main (){

Int I, k;

Int m, n;

Int j;

Printf ("Enter the purchased number: \ n ");

Scanf ("% d", & I );

J = jieguo ();

If (I = j)

Printf ("the winning amount is 500 RMB \ n ");

If (I % 100 = j % 100)

Printf ("the winning amount is 150 RMB \ n ");

For (m = 1; m <= 5; m ++ ){

I = I % 100;

For (k = 1, n = 0; k <= 5; k ++ ){

J = j % 100;

If (I = j)

N = n + 1;

}

}

Printf ("% d \ n", n );

If (n = 5 & j % 100 = I % 100)

Printf ("the prize is 3000 \ n ");

If (n = 5 & j % 100! = I % 100) | (n = 4 & j % 100 = I % 100 ))

Printf ("the prize is 200 \ n ");

If (n = 4 & j % 100! = I % 100) | (n = 3 & j % 100 = I % 100 ))

Printf ("the reward is 10 \ n ");

If (n = 2 & j % 100 = I % 100) | (n = 1 & j % 100 = I % 100) | (n = 0 & j % 100 = I % 100 ))

Printf ("5 \ n ");

}

 

 

 

 

Double jieguo (){

Int a, B;

Int I;

Double sum;

Srand (time (NULL ));

For (I = 1, sum = 0; I <= 6; I ++ ){

A = rand () % 37;

// Printf ("% d \ n", );

Sum = sum * 100;

Sum + =;

}

B = rand () % 17;

Sum = sum * 100 + B;

Return sum;

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.