Results 1 to 4 of 4

Thread: C++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User tanago's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 322

    C++

    , N (3<=N<=7) N- , [P;Q]
    3 (3)

    Code:
    #include<iostream.h>
    void Print (int a[],int n)
    {
         for (int i=0;i<n;i++)
         cout<<a[i];
         cout<<endl;
    }
    int endv(int a[],int n)
    {
        for(int i=0;i<n;i++)
        if(a[n]==0)return 0;
        return 1;
    } 
    int main()
    {
        int a[7],n,p,q;
        do 
        {
            cout<<"n=";cin>>n;
        }
        while(n<3 || n>7);
        cout<<"p=";
        cin>>p;
        do
        {
               cout<<"q=";
               cin>>q;
        }
        while(q<p);
        system("pause");
        return 0;
    }

  2. #2
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    1 - , 816. ?
    , .

  3. #3
    Registered User tanago's Avatar
    Join Date: Jul:2009
    Location:
    Posts: 322
    816%10=6
    816/10=81
    81%10=1
    81/10=8

    6+1+8=15

    #include<iostream.h>
    int main()
    {
    int number=816,sbor=0,a;
    do
    {
    if(number<10)sbor=sbor+number;
    else sbor=sbor+(number%10);
    number=number/10;
    }
    while(number!=0);
    cout<<sbor;
    system("pause");
    return 0;
    }
    , .
    Last edited by tanago; 7th December 2010 at 19:40.

  4. #4
    Registered User
    Join Date: Oct:2003
    Location:
    Posts: 4,317
    - - N- , . , . N 7, .

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 |