Announcement

Collapse
No announcement yet.

Unconfigured Ad Widget

Collapse

Mujhe c per ek programm chaye (its urgent)

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Mujhe c per ek programm chaye (its urgent)

    mujhe c program per ek programm chaye jo even numbers or odd numbers ko alag alag kar kay batye or baad mein even or odd Number ka sum kar kay answer bhi bataye

    (NOTE) only is program mein (while loop -if - else - modulus ) condition lagi hoon or koi na hoon plz urgent chaye


    i'm using
    #include <iostream>
    using namespace std;
    main ()
    {
    continue......

  • #2
    Re: Mujhe c per ek programm chaye (its urgent)

    asalamualaikum.
    filhaal mukhtasir waqt mein yahi likh saka hoon. iss pseudocode ko aap C k syntax mein likh lijeay ga. kuch samajh nae ayi to pooch lijeay.

    Code:
    int odd[10];
    int even[10];
    boolean check = false;
    int forEven = 1;
    int forOdd = 1;
    
    
    [B]void main() {[/B]
    
        int temp;
        for(int i = 0; i <= 9; i++) {
            print << "Enter Number: ";
            input >> temp;
            [B]evenORodd(temp);[/B]
            if(check == true) {
                even[forEven] = temp;
                forEven++;
            }
            else {
                odd[forOdd] = temp;
                forOdd++;
            }
        } [COLOR=teal]//end of for-loop[/COLOR]
    
        print << [I]newline[/I] << [I]newline[/I];
    
    [B]printEven();
    printOdd();[/B]
    [B]addition();[/B]
    
    [B]}[/B] [COLOR=teal]//end of main[/COLOR]
    
    
    [B]void evenORodd(int num) {[/B]
        int temp = num;
        int ans = temp % 2;
    
        if(ans == 0)
            check = true;
        else
            check = false;
    [B]}[/B] [COLOR=teal]//end of evenORodd[/COLOR]
    
    
    [B]void printEven() {[/B]
        print << "Even Numbers" << [I]newline[/I];
        for(int i = 0; i <= 9; i++) {
            print << even[i] <<[I] newline[/I];
        } [COLOR=teal]//end of for-loop[/COLOR]
        
        print <<[I] newline[/I];
    [B]}[/B] [COLOR=teal]//end of printEven[/COLOR]
    
    
    [B]void printOdd() {[/B]
        print << "Odd Numbers" << [I]newline[/I];
        for(int i = 0; i <= 9; i++) {
            print << odd[i] << [I]newline[/I];
        } [COLOR=teal]//end of for-loop[/COLOR]
        
        print << [I]newline[/I];
    [B]}[/B] [COLOR=teal]//end of printOdd
    [/COLOR]
    
    [B]void addition() {[/B]
        for (int i = 0; i <= 9; i++) {
            int temp = even[i] + odd[i];
            print << even[i] << " + " << odd[i] << " = " << temp << [I]newline[/I];
        } [COLOR=teal]//end of for-loop[/COLOR]
    }

    Comment


    • #3
      Re: Mujhe c per ek programm chaye (its urgent)

      urgent reply me

      Comment


      • #4
        Re: Mujhe c per ek programm chaye (its urgent)

        itnay wadda programmer hotay tu aur kaya chahiye tha. Waisay assignment banday ko khud kerni chaiye.

        Comment


        • #5
          Re: Mujhe c per ek programm chaye (its urgent)

          Originally posted by Max_ View Post
          itnay wadda programmer hotay tu aur kaya chahiye tha. Waisay assignment banday ko khud kerni chaiye.
          hahaha, true,, yeh assignment he aai hogi,,,

          Comment


          • #6
            Re: Mujhe c per ek programm chaye (its urgent)

            Originally posted by Rizvann View Post
            mujhe c program per ek programm chaye jo even numbers or odd numbers ko alag alag kar kay batye or baad mein even or odd Number ka sum kar kay answer bhi bataye

            (NOTE) only is program mein (while loop -if - else - modulus ) condition lagi hoon or koi na hoon plz urgent chaye




            #include <iostream>
            using namespace std;
            main ()
            {
            continue......

            kuch khas smjh nahi aai k chahye kia??? main bhi C++ he parh raha hun,, aap kahin VU k to nahi??
            i'm using

            Comment

            Working...
            X