DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 5 of 5

Thread: element

  1. #1
    Join Date
    Nov 2007
    Posts
    18

    element

    How to choose one element from each array., Which A(i)+B(i)+C(i)+D(i)+E(i)+F(i) must equal to 10.

    __________________________________________________
    i A B C D E F
    __________________________________________________
    1 3 2 3 3 2 4
    __________________________________________________

    2 6 9 4 24 5 7
    __________________________________________________

    3 11 28 5 81 10 12
    __________________________________________________

    4 18 65 6 192 17 19
    __________________________________________________

    5 27 126 7 375 26 28
    __________________________________________________

    6 38 217 8 648 37 39
    _________________________

  2. #2
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    how 10 ?
    if we use the minimal element in each array we get the sum of elements in the first row (i=1) which is greater than 10
    please explain more what's wanted ? and if you have some algorithm mention it or its name.
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

  3. #3
    Join Date
    Apr 2007
    Location
    Sterling Heights, Michigan
    Posts
    8,663
    Quote Originally Posted by Amahdy
    and if you have some algorithm mention it or its name.
    Better still, post it.

  4. #4
    Join Date
    Nov 2007
    Posts
    18
    like this, but I want to choose one elemet from each array, which the sum of A(i)+B(i)+C(i)
    +D(i)+E(i)+F(i)=10. Which mean the value of i.

    Code:
    int total = 0;
    for(int i = 0;i<10;i++)
    {
    total = a[i] + b[i] + c[i] + d[i] + e[i];
    if(total==10)
    {
    printf("total is 10");
    }
    total=0;
    }

  5. #5
    Join Date
    Oct 2005
    Location
    Maady
    Posts
    1,819
    your psted code will never be true for the given array
    and a[i] is the value of the element number "i" in the array "a" ...
    if you mean the value of "i" what can we do with the array ?? here is some example : 3+2+2+1+1+1 ... but I'm sure this is not what's wanted here , please tell me exactly what you want to do ?
    Programmer&Cracker CS
    MyBlog:Blog.Amahdy.com
    MyWebsite:www.Amahdy.com

Similar Threads

  1. STL map ( no unique element )
    By overule in forum C++
    Replies: 3
    Last Post: 02-25-2007, 09:23 AM
  2. JDOM Classpath Help Required
    By kpandya in forum Java
    Replies: 5
    Last Post: 01-15-2006, 08:10 PM
  3. Replies: 0
    Last Post: 08-15-2002, 09:05 AM
  4. AVL Tree element index
    By John in forum Java
    Replies: 2
    Last Post: 04-29-2001, 05:01 PM
  5. Emphasis of element within element using xsl
    By Jenny Cheok in forum XML
    Replies: 0
    Last Post: 11-24-2000, 04:13 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center