Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

C Exercise 81

C Exercise 81

100 Classic C Language Examples 100 Classic C Language Examples

Problem: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*??.

**Analysis:** None.

Example

// Created by www.runoob.com on 15/11/9.

// Copyright (c) 2015 Runoob Tutorial. 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 above example produces the following output:



9708 = 800 * 12 + 9 * 12

100 Classic C Language Examples 100 Classic C Language Examples