Level 2 C language (3)

xiaoxiao2021-03-05  19

1.4. Digital recombination

Among them: 1. Take a long integer odd bit (or even digit) to form a new number; 2. Two digits to form a new 4-digit number (such as: 45 and 12);

3. Remove the low N-1 bit of N-axis (eg, the number 5923, the resulting result 923);

W = S; b = 1;

While (S / 10)

{

B * = 10;

s / = 10;

}

w = w% b;

4. Keep the M bit decimal to a real number X, and the m 1 of the decimal point is rounded.

Example 5. Please prepare a functionality FUN (), its function is: calculating and outputting the sum of the squares of the number of all prime numbers between 3 to n.

Note: Some source programs have been given.

Do not change the contents of the main function main ().

Question procedure:

#include

#include

Float Fun (Float H)

{

}

Main ()

{

Float a;

CLRSCR ();

Printf ("/ N / NINPUT A:");

Scanf ("% f", & a);

Printf ("/ n / nthe result =% f / n / N", FUN (a));

}

Difficulties in this question: How to deal with the thousands of points to go all over, then go to the percentile

Reference answer:

Float Fun (Float H)

{

Long V;

v = 100 * h 0.5;

Return (FLOAT) V / 100;

}

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

New Post(0)