Results 1 to 3 of 3

Thread: :)

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date: Apr:2008
    Location: 25
    Posts: 1

    :)

    .
    20 ?



    // ConsoleApplication1.cpp : Defines the entry point for the console application.
    //

    #include "stdafx.h"

    #include<stdio.h>
    int main()
    {
    int a[11];
    int i, suma, pro;
    printf("vavedete stoinosta na masiva : \n");
    for (i = 1; i <= 11; i++);
    {
    printf_s("a[%d]", i);
    scanf_s("%d", &a[i]);
    }
    suma = 0;
    pro = 1;
    for (i = 1; i <= 11; i++);
    {suma += a[i];
    pro = pro*a[i];
    }
    printf("sumata e : %d", suma);
    printf("pro e : %d", pro);

    return 0;
    }

    Click image for larger version. 

Name:	20160915_185229.jpg 
Views:	26 
Size:	44.5 KB 
ID:	84843

  2. #2
    Banned
    Join Date: Mar:2008
    Location: ( ͡ ͜ʖ ͡)
    Posts: 10,614
    ? ?

    - - . , [] < , -> , .

  3. #3
    Registered User GringoBG's Avatar
    Join Date: Jan:2009
    Location: Sofia,Bulgaria
    Posts: 656
    : - ; - 0- ; -, ++.

    :

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main() {
        const int ArrSize = 20;
        int arr[ArrSize];
        int min = 0;
        int position = 0;
        
        cout << "Enter 20 array elements.\n";
        
        for(int i = 0; i < ArrSize; i++) {
            cin >> arr[i];
        }
        
        min = arr[0];
        
        for(int i = 1; i < ArrSize; i++) {
            
            if(arr[i] < min) {
                min = arr[i];
                position = i + 1;
            }
        }
        
        cout << "Minimum element is: " << min << ".\n";
        cout << "The position is: " << position << ".\n";
    
        return 0;
    }
    Last edited by GringoBG; 17th September 2016 at 23:35.
    AMD Ryzen 5 5600x | Noctua NH-D15 | GB B550 Aorus Pro AC | 2x8 GB DDR4 Corsair Corsair Vengeance LPX @ 3200 Mhz | GW 3070 Phoenix GS | Corsair RM850 "Gold" | Seagate Barracuda 500GB | SanDisk SSD Plus 240 GB | ADATA 480 GB | Fractal Design Core 3000 |

    Lenovo IdeaPad 510 + Patriot Blast 240GB

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 |