program is not compiling

0 chinesh doshi · September 11, 2015
#include <stdio.h>
#include <stdlib.h>

int main()
{
    float c , a , b;
    printf("enter the distance \n");
    scanf("%d \n" , &c);
    a = c * 1000 ;
    printf("in meters %d meters \n" , &a );
    b = 15 * c ;
    printf("in feets %d \n" , &b);

    return 0;
}

Post a Reply

Replies

Oldest  Newest  Rating
0 Suraj Gautam · September 13, 2015
use %f type specifier while using float :)
0 Sandra T · September 12, 2015
You're welcome!
0 chinesh doshi · September 12, 2015
okk thank u :)
0 Sandra T · September 12, 2015
#include <stdio.h>
#include <stdlib.h>

int main() {
float c , a , b;
printf("enter the distance\n");
scanf("  %f ", &c);
a = c * 1000 ;
printf("in meters %f meters\n" , a );
b = 15 * c ;
printf("in feets %f\n" , b);

      return 0;

}

When is like that, it works. But after you insert  the distance you must press enter and another  key...I don't know why!
ADVICE:     - when you scan an array, don't use  &. Use it only when you scan variables.
                     -don't use  &  when you print something.
  • 1

C

106,999 followers
About

One of the most popular languages of all time.

Links
Moderators
Bucky Roberts Administrator