Results 1 to 13 of 13

Thread: ++

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User qqmmaaiill's Avatar
    Join Date: Jun:2010
    Location: Sofia
    Posts: 259

    ++

    . , . , ++ . , . !!!Click image for larger version. 

Name:	20141218_101709.jpg 
Views:	123 
Size:	46.8 KB 
ID:	73081
    Intel Core i7 4770K @ 3,5GHz | H80i | 4x4GB 1600Mhz | 500GB WD SSD| GTX 1060 | 690 II Advanced | 700W Hypro | AGON 271QX | Windows 10 Pro x64 + Fedora 32

  2. #2
    Private's Avatar
    Join Date: Jan:2002
    Location:
    Posts: 32,164
    .
    .
    -= All our life, we are beta testers =-
    -= ! , [] ! =-
    -= =-= : Fo , goblin =-

  3. #3
    Registered User qqmmaaiill's Avatar
    Join Date: Jun:2010
    Location: Sofia
    Posts: 259
    , . , . . , . , 2, , S=1 S=S*2, 1? /2 .

    :

    #include<iostream>
    #include<math.h>
    using namespace std;
    int main ()
    {
    int n;
    cout<<"n=";cin>>n;
    int arr[n];
    int S=0;
    for(int i=0;i<n;i++)
    {
    cin>>arr[i];
    }
    /*for (int i = 0; i < n - 1; i++)
    {
    for (int j = i + 1; j < n; j++)
    {
    if (arr[i] > arr[j]) // swap items
    {
    int tmp = arr[i];
    arr[i] = arr[j];
    arr[j] = tmp;
    }
    }
    }*/
    for(int i=0;i<n;i++)
    {
    for(int j=1;j<arr[i]/2;j++)
    {
    if(arr[i]%j==0)
    {
    S=S+j;
    }
    }
    if(S==arr[i])
    {
    cout<<arr[i];
    }
    }
    }
    Intel Core i7 4770K @ 3,5GHz | H80i | 4x4GB 1600Mhz | 500GB WD SSD| GTX 1060 | 690 II Advanced | 700W Hypro | AGON 271QX | Windows 10 Pro x64 + Fedora 32

  4. #4
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90

    , 2. , 2 - else
    while , 2 - while if>1
    while 1 ( ) - 2
    ...
    Code:
    	int number = 1024;
    	
    	if((number % 2) == 0 || number == 1){
    		while((number % 2) == 0 ||  number < 1){
    			number /= 2;
    		}
    		if(number > 1){
    			cout << "ne e stepen na 2";
    		}else if (number == 1){
    			cout << "stepen na 2";
    		}
    	}else{
    		cout << "ne e stepen na 2";
    	}

  5. #5
    Registered User qqmmaaiill's Avatar
    Join Date: Jun:2010
    Location: Sofia
    Posts: 259
    ,

    for(int i=0;i<n;i++)
    {
    if((arr[i] % 2) == 0 || arr[i] == 1)
    {
    while((arr[i] % 2) == 0 || arr[i] < 1)
    {
    arr[i] /= 2;
    }
    if (arr[i] == 1)
    {
    flag++;
    }
    }
    }
    if(flag>0)
    {
    cout<<"Ima stepen na 2";
    };

    , , ( , ), . , , . .
    Intel Core i7 4770K @ 3,5GHz | H80i | 4x4GB 1600Mhz | 500GB WD SSD| GTX 1060 | 690 II Advanced | 700W Hypro | AGON 271QX | Windows 10 Pro x64 + Fedora 32

  6. #6
    Registered User
    Join Date: Apr:2011
    Location:
    Posts: 90

    - if
    isPerfectly(arr[i]) ...
    true - - arr[i]
    - , 1 , i
    i ( i )


    Code:
    bool isPerfectly(int n){
    	int sum = 0;
    	for (int i = 1; i < n ; i++) {
    		if((n % i) == 0){
    			sum += i;
    		}
    	}
    	if(n == sum){
    		return true;
    	}else{
    		return false;
    	}
    }

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 |