1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

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,292
    Likes Received:
    365
    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