(C syntax) sum of approx. and sum of approx.
Knowledge point:
An algorithm used to calculate an appointment
For statement, if statement flexible use.
Content: enter a natural number and calculate the sum of all the approximate numbers of the natural number.
Input description:
An integer
Output description:
An integer
Input example:
6
Output example:
12
1 #include <stdio.h> 2 int main() 3 { 4 int n,s=0,i; 5 scanf("%d",&n); 6 for (i=1;i<=n;i++) 7 { 8 if (n%i==0) 9 {10 s=s+i;11 }12 }13 printf("%d\n",s);14 return 0;15 }
How does one use the C language to calculate the sum of all the approximate numbers of an integer?
# Include <stdio. h>
Int main (int argc, char * argv [])
{
Int I, a, sum;
While (scanf ("% d", & )! = EOF)
{
Printf ("% d's approximate numbers include:", );
Sum = 0;
For (I = 1; I <= a; I ++)
If (a % I = 0)
Sum + = I, printf ("% d,", I );
Printf ("sum of approx. % d \ n", sum );
}
Return 0;
}
A is A prime number. 7A has () approx. A3 B4 C3 or 4 on A drawing with A scale of 10:1. The figure 2cm indicates the actual () 2 cm 2mm 20 cm.
A is A prime number, and 7A has (A has 3:, A) approx. A 3 B .4 C.3 or 4
On a drawing with a scale of, 2cm indicates the actual (20 cm) 2 cm 2mm
A's five or six products are equal to B's number. 80%. A's number is equal to B's number.
A and B cylinder, bottom area ratio, Volume Ratio A and B ratio ()