C Practice Example 81

100 Classic C Examples

Title:809*??=800*??+9*??, where ?? represents a two-digit number. 809*?? is a four-digit number, the result of 8*?? is a two-digit number, and the result of 9*?? is a three-digit number. Find the two-digit number represented by ??, and the result of 809*??.

Program analysis:None.

Example

// Created by www.example.com on 15/11/9. // Copyright © 2015 Example. All rights reserved. #include <stdio.h> void output(long int b, long int i){ printf("\n%ld = 800 * %ld + 9 * %ld\n", b,i,i); } int main(){ void output(long int b, long int i); long int a,b,i; a = 809; for(i = 10; i < 100; i++){ b = i * a; if (b >= 1000 && b <= 10000 && 8 * i < 100 && 9 * i >= 100){ output(b, i); } } return 0; }

The output result of running the above example is:

9708 = 800 * 12 + 9 * 12

100 Classic C Examples

other extensions