Error in the program & I need some programs. Can you help me

Discussion in 'C' started by wd.hamaden, Jul 27, 2011.

  1. wd.hamaden

    wd.hamaden New Member

    Joined:
    Jul 27, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    in this program there error i don't know where!! and i need the out put from it .

    #include<stdio.h>
    void main(void)
    void change(void);
    int x=4,y;
    y=x;
    {
    printf("\n The value of x is = %f and the value of y is = %d",x,y);
    change();
    printf("\n The value of x is = %d and the value of y is = %d ",x,y);
    }
    void change(void)
    {
    x=x+3;
    }

    ــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــــ
    and i need this programs plz .. can u help me

    (a) Write a C program that uses two user defined functions, one of the functions calculates the sum and the other calculates the product of two numbers.
    (b) Write a C program that uses pointers to calculate the sum of the elements of an array.
    (c) Write a C program that declares and initializes two variables and then write their values on a file.
     
  2. wd.hamaden

    wd.hamaden New Member

    Joined:
    Jul 27, 2011
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
  3. DRK

    DRK New Member

    Joined:
    Apr 13, 2012
    Messages:
    44
    Likes Received:
    3
    Trophy Points:
    0
    1. Correct definiton
    Code:
    int y,x=4;
    2. Assignment instruction must be in a function
    Code:
    int main()
    {
      y=x;
      // other instructions
      return 0;
    }
    3. Why do you want to display integer value as floating-point?
    Code:
    printf("\n The value of x is = [COLOR="Red"]%f[/COLOR] and the value of y is = %d",x,y);
    4.
    Compile and run the program.
     

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