Results 1 to 10 of 10
Thread: -
Hybrid View
-
18th January 2012 16:31 #1Registered User
Join Date: Jan:2012
Location: Sofia
Posts: 5
-
30 [10;1000]. , 7. :
-
-
- , .
:
#include<iostream.h>
#include<stdlib.h>
int Sum_digits(int );
void Gen (int []);
void Cout (int []);
int main()
{
int a[30];
randomize ();
Gen (a);
Cout (a);
Int kol;
Int pruchka=0;
for (int i=0; i<30; i++)
{
kol=a[i];
pruchka=sum_digits(kol);
if pruchka %7==0) cout<<a[i]<< ;
}
return 0;
}
int sum_digits (int k)
{
int suma=0;
do
{
suma+=k%10;
k=k/10;
}
while (k!=0);
return suma;
}
void Gen (int arr[])
{
for (int i=0; i<30; i++)
{
arr[i]=random(991)+10;
}
}
void Cout (int arr[])
{
for (int i=0;i<30;i++)
cout<<arr[i]<<" ";
cout<<endl;
}
, .. , ..
Last edited by lamptz; 18th January 2012 at 22:31.
-
18th January 2012 17:30 #2
, ?
UD3R|Q9550+1283|4x2 G.Skill@1066|MX500+1002FAEX+640AAKS+ST31 60|RX580-8GB|1841BLT|SS-760XP|Define7|z24i|Edifier S350DB
geniusloci: ) ; ) ; ) ?
nope|r.i.p.
-
18th January 2012 17:33 #3Registered User
Join Date: Jul:2004
Location:
Posts: 621
7 3 :
Edit: ... ?Code:for (int i=0; i<3; i++) if (sum_masive (a, i) %7==0) cout<<a[i];

"" . "sum_masive (a, i)" "sum_digits(a[i])"
-
18th January 2012 17:38 #4Registered User
Join Date: Jan:2012
Location: Sofia
Posts: 5
sum_digits
--------- 17:38 --------- : 17:36 ---------
!!! ..
-
18th January 2012 17:42 #5Registered User
Join Date: Jul:2004
Location:
Posts: 621
. , int . int , (. sum_digits) "" a[i] . , (sum_masive) "" .
, "pass by value" "pass by reference"
-
18th January 2012 17:43 #6Registered User
Join Date: Jan:2012
Location: Sofia
Posts: 5
.. .. !!!
-
18th January 2012 17:46 #7Registered User
Join Date: Jul:2004
Location:
Posts: 621
, "int sum_digits(int n)"




Reply With Quote
Lenovo ThinkPad 15 IdeaPad 15
5th May 2023, 22:16 in