User Profile

Collapse

Profile Sidebar

Collapse
way87
way87
Last Activity: Sep 25 '07, 09:02 PM
Joined: Sep 25 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • way87
    replied to C++ Program to Calculate X^Y
    in C
    #include <stdio.h>
    #include <math.h>

    int main (void)
    {
    double x;
    double y;
    double result;

    printf("Enter an integer for x\n");
    scanf("%d",&x);

    printf("Enter an integer for y\n");
    scanf("%d",&y);

    result = pow(x,y);

    printf("x...
    See more | Go to post

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    im really stuck,i dunno how to fix it
    See more | Go to post

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    it should not be correct..
    becoz the output should be:
    1
    4
    9
    16
    25
    36
    49
    64
    81
    100

    ?
    See more | Go to post

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    [code=c]
    #include <stdio.h>
    #include <math.h>

    int main ()
    {
    double x = 1;
    double y = 1;
    double result;

    for ( x = 1; x <= 10; x++ ){
    printf("%f\n",r esult = pow(x,y) );
    }


    return 0;
    }
    [/code]
    i did it but the output is seems not correct:
    ...
    See more | Go to post
    Last edited by sicarie; Sep 25 '07, 08:26 PM. Reason: Code tags

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    i still have no idea about doubles =(...
    See more | Go to post

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    is it ok?
    [code=c]
    #include <stdio.h>
    int square(int y);

    int main (void)
    {
    int x;
    for (x = 0;x>=0;x++) {
    printf ("%d",square (x) );
    }

    printf("\n");

    return 0;
    }

    int square (int y)
    {
    return y*y;
    }[/code]
    See more | Go to post
    Last edited by way87; Sep 25 '07, 07:55 PM. Reason: correction

    Leave a comment:


  • way87
    replied to C++ Program to Calculate X^Y
    in C
    i jus started to do programming since last month and i still a newbie =(
    i cant solve the question ,it's hard for me =(
    See more | Go to post

    Leave a comment:


  • way87
    started a topic C++ Program to Calculate X^Y
    in C

    C++ Program to Calculate X^Y

    Question:
    Write a Program using Functions that calculates X^Y where both X and Y are doubles and X is positive. (Hints: Call the function pow() in <math.h>)
    See more | Go to post
No activity results to display
Show More
Working...