1. We have moved from vBulletin to XenForo and you are viewing the site in the middle of the move. Though the functional aspect of everything is working fine, we are still working on other changes including the new design on Xenforo.
    Dismiss Notice

C programing

Discussion in 'C' started by ankushgupta, Aug 22, 2007.

  1. ankushgupta

    ankushgupta New Member

    Joined:
    Aug 22, 2007
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Q. 1 Write algorithm for the following :
    a) to check whether an entered number is odd / even.
    b) to calculate sum of three numbers.

    pls. solve this.
     
  2. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,276
    Likes Received:
    364
    Trophy Points:
    83
    Solution 1:
    Code:
    if(num % 2 == 0)
      Num is Even
    else
      Num is Odd
    Solution 2:
    Code:
    res = a+b+c;
     

Share This Page