Classic C procedure 100 case == 81--90

xiaoxiao2021-03-06  46

[Program 81] Title: 809 * ?? = 800 * ?? 9 * ?? 1 Among them, the two digits of the representative, 8 * ?? the result of two digits, 9 * ?? the result of 3 Bit number. Request for the two digits of the representative, and the result of 809 * ??. 1. Program analysis: 2. Source code: OUTPUT (long b, long i) {printf ("/ n% ld /% ld = 809 *% ld % ld", B, I, I, b% i); } main () {long Int A, B, I; A = 809; for (i = 10; i <100; i ) {b = i * a 1; if (b> = 1000 && b <= 10000 && 8 * i < 100 && 9 * i> = 100) Output (b, i);}} ================================== ============================ 【Program 82】 Title: Octa conversion to decimal 1. Program analysis: 2. Program source code: main () {char * p, s [6]; int N; p = S; Gets (p); n = 0; while (* (p)! = '/ 0') {n = n * 8 * P -'0 '; p ;} Printf ("% d", n);} =============================== ======================================= 【Program 83】 Title: Seeking the odd number of odd numbers that can be composed of 0-7.

1. Program analysis: 2. Source code: main () {long sum = 4, s = 4; int J; for (j = 2; j <= 8; j ) / * j is place of number * / { Printf ("/ n% ld", sum); if (j <= 2) s * = 7; else * = 8; SUM = S;} Printf ("/ nsum =% ld", sum);} == ============================================================================================================================================================================================================= ========== [Program 84] Title: A number of even numbers can be represented as the sum of two prime numbers.

1. Program analysis: 2. Source code: #include "stdio.h" #include "math.h" main () {Int A, B, C, D; scanf ("% d", & a); for B = 3; B <= a / 2; b = 2) {for (c = 2; c <= SQRT (B); C ) IF (b% c == 0) Break; if (c> sqrt (B )) D = ab; elsebreak; for (c = 2; c <= SQRT (D); C ) IF (D% c == 0) Break; if (c> SQRT (D)) Printf ("% D = % D % D / N ", A, B, D);}} =================================== ============================= 【Program 85】 Title: Judgment a number of numbers can be taken 9 整 1. Program analysis: 2 . Source code: main () {long int m9 = 9, sum = 9; int zi, n1 = 1, c9 = 1; scanf ("% d", & zi); while (n1! = 0) {IF ! (sum% zi)) N1 = 0; ELSE {m9 = m9 * 10; sum = SUM M9; C9 ;}} printf ("% ld, can be divided by% D /" 9 / ", SUM, C9);} ============================================== ================ 【Program 86】 Title: Two string connections 1. Program analysis: 2. Source code: #include "stdio.h" main () { Char a [] = "acegikm"; char b [] = "bdfhjlnpq"; char C [80], * p; int i = 0, j = 0, k = 0; while (a [i]! = '/ 0 '&& B [J]! =' / 0 ') {IF (a [i] {c [k] = a [i]; i ;}

Else

C [K] = B [J ];

K ;

}

C [K] = '/ 0';

IF (a [i] == '/ 0')

P = B J;

Else

P = A I; STRCAT (C, P);

PUTS (C);

}

============================================================================================================================================================================================================= ============

[Program 87]

Topic: Answer results (structural variable delivery)

Program analysis:

2. Program source code:

#include "stdio.h"

Struct student

{INT X;

Char C;

} a;

Main ()

{a.x = 3;

A.c = 'a';

f (a);

Printf ("% D,% C", A.X, A.C);

}

F (Struct Student B)

{

B.x = 20;

B.c = 'y';

}

============================================================================================================================================================================================================= ============

[Program 88]

Title: Read 7 (1-50) integer values, each read a value, printed the number of the number of the value.

Program analysis:

2. Program source code:

Main ()

{INT I, A, N = 1;

While (n <= 7)

{DO {

Scanf ("% d", & a);

WHILE (a <1 || a> 50);

For (i = 1; i <= a; i )

Printf ("*");

Printf ("/ n");

N ;

Getch ();

}

============================================================================================================================================================================================================= ============

[Program 89]

Topic: A company uses public telephone delivery data, data is four-digit integers, encrypted during transmission, encrypted rules are as follows:

Each number is added to 5, and then uses and divides the number at 10, and the first bit and the fourth bit are exchanged, the second and third digits are exchanged. Program analysis:

2. Program source code:

Main ()

{Int A, I, AA [4], T;

Scanf ("% d", & a);

AA [0] = a% 10;

AA [1] = a% 100/10;

AA [2] = a% 1000/100;

AA [3] = A / 1000;

For (i = 0; i <= 3; i )

{aa [i] = 5;

AA [I]% = 10;

}

For (i = 0; i <= 3/2; i )

{t = aa [i];

AA [I] = aa [3-i];

AA [3-I] = T;

}

For (i = 3; I> = 0; I -)

Printf ("% D", AA [I]);

}

============================================================================================================================================================================================================= ============

[Program 90]

Topic: Monolithic this question, read results.

Program analysis:

2. Program source code:

#include "stdio.h"

#define m 5

Main ()

{INT A [M] = {1, 2, 3, 4, 5};

INT I, J, T;

i = 0; j = m-1;

While (i

{T = * (A I);

* (A I) = * (A J);

* (a j) = t;

i ; J-;

}

For (i = 0; i

Printf ("% d", * (a i));

}

转载请注明原文地址:https://www.9cbs.com/read-73556.html

New Post(0)