WHat will this code produce? - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

WHat will this code produce?

Panasonic99Panasonic99 Posts: 140Member
#include
#include

void main()
{
int i = 25, j = 2, k = 5;
printf("%.2f
", sqrt(i));
printf("%.2f
", pow(j,k));

}



it aint working for me

Comments

  • bell2bell2 Posts: 9Member
    Well, if you change the code around a bit:
    #include
    #include

    int main() /* If you compiled with a C++ compiler you must change main()'s return type to 'int'. */
    {
    int i = 25, j = 2, k = 5;
    printf("%.2f
    ", sqrt(i));
    printf("%.2f
    ", pow(j,k));

    /* Get some input, so the program stays running long enough to read the output. */
    int extra;
    scanf("32%s", extra);
    }

    ...You get this for output:
    5.00
    32.00


  • Panasonic99Panasonic99 Posts: 140Member
    how?
  • DonotaloDonotalo Posts: 715Member
    : #include
    : #include
    :
    : void main()
    : {
    : int i = 25, j = 2, k = 5;
    : printf("%.2f
    ", sqrt(i));
    : printf("%.2f
    ", pow(j,k));
    :
    : }
    :
    :
    :
    : it aint working for me

    the code is clearly fine and obviously produce some valid output as i expected. why dont u check with a compiler rather than asking us? what is ur expectation from the code? be more specific.
  • stoberstober Posts: 9,765Member ✭✭✭
    : how?
    :
    you been watching some old John Wayne westerns? How what???

Sign In or Register to comment.