Results 1 to 10 of 10

Thread: -

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered 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.

  2. #2
    System.gc()'s Avatar
    Join Date: Apr:2007
    Location: back in time
    Posts: 1,075
    , ?
    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.

  3. #3
    Registered User
    Join Date: Jul:2004
    Location:
    Posts: 621
    7 3 :
    Code:
    for (int i=0; i<3; i++)
    if (sum_masive (a, i) %7==0) cout<<a[i];
    Edit: ... ?
    "" . "sum_masive (a, i)" "sum_digits(a[i])"

  4. #4
    Registered User
    Join Date: Jan:2012
    Location: Sofia
    Posts: 5
    sum_digits

    --------- 17:38 --------- : 17:36 ---------

    !!! ..

  5. #5
    Registered User
    Join Date: Jul:2004
    Location:
    Posts: 621
    . , int . int , (. sum_digits) "" a[i] . , (sum_masive) "" .

    , "pass by value" "pass by reference"

  6. #6
    Registered User
    Join Date: Jan:2012
    Location: Sofia
    Posts: 5
    .. .. !!!

  7. #7
    Registered User
    Join Date: Jul:2004
    Location:
    Posts: 621
    , "int sum_digits(int n)"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Copyright © 1999-2011 . .
iskamPC.com | mobility.BG | Bloody's Techblog | | 3D Vision Blog |