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,375
    Likes Received:
    388
    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

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice