h_h1354's Profile User Rating: -----

Reputation: 0 Apprentice
Group:
New Members
Active Posts:
2 (0 per day)
Joined:
31-January 12
Profile Views:
254
Last Active:
User is offline Jan 31 2012 11:37 AM
Currently:
Offline

Previous Fields

Dream Kudos:
0
Icon   h_h1354 has not set their status

Posts I've Made

  1. In Topic: Min odd and min even of 6 entry without loop in c/c++

    Posted 31 Jan 2012

    #include <iostream>
    #include <cstdio>
    using namespace std;
    int main()
    {
        int a1,a2,a3,a4,a5,a6;
        int odd_count=1,even_count=1;
        int odd1,odd2,odd3,odd4,odd5,odd6;
        int eve1,eve2,eve3,eve4,eve5,eve6;
        int min_odd, min_even;
        
       printf(" please enter 6 number");
       scanf("%d",&a1);
        scanf("%d",&a2);
        scanf("%d",&a3);
        scanf("%d",&a4);
        scanf("%d",&a5);
        scanf("%d",&a6);
        
        if (a1%2==0)
         min_even=a1; 
    
          else if (a1%2!=0)
          min_odd=a1;
                
                 
                if (a2%2==0 && a2<min_even)
                min_even=a2;
               
    
                else if (a2%2!=0 && a2<min_odd)
                min_odd=a2;
                
                
                
                
                                  if (a3%2==0 && a3<min_even)
                                  min_even=a3;
                                  
    
                                  else if (a3%2!=0 && a3<min_odd )
                                  min_odd=a3;
                                
                
                
                
                
                
                                   if (a4%2==0 && a4<min_even)
                                   min_even=a4;
                               
    
                                   else if (a4%2!=0 && a4<min_odd  )
                                   min_odd=a4;
                                   
                     
                
                
                
                                   if (a5%2==0 && a5<min_even)
                                     min_even=a5;
                                  
    
                                     else if (a5%2!=0 && a5<min_odd  )
                                      min_odd=a5;
                                 
              
              
                                      if (a6%2==0 && a6<min_even)
                                      min_even=a5;
                                    
     
                                      else if (a6%2!=0 && a6<min_odd  )
                                       min_odd=a6;
                                       
                printf( "odd %d",min_odd);
                printf( "odd %d",min_even);
                
                system("pause");
    }
    



    :code:

My Information

Member Title:
New D.I.C Head
Age:
Age Unknown
Birthday:
Birthday Unknown
Gender:

Contact Information

E-mail:
Click here to e-mail me

Friends

Comments

h_h1354 has no profile comments yet. Why not say hello?