By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,906 Members | 1,388 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,906 IT Pros & Developers. It's quick & easy.

IO error reading variable in and printing it out.

P: 1
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<math.h>
  3.  main()
  4. {
  5. double input,F,t;                                         
  6. scanf("%f\n",&input);
  7. printf("input= %f\n",input);
  8.  
in the output showing ,
satya@localhost programm]$ ./pow
13.0
input= 2.165711
May 27 '07 #1
Share this Question
Share on Google+
3 Replies


Savage
Expert 100+
P: 1,764
#include<stdio.h>
#include<math.h>
main()
{
double input,F,t;
scanf("%f\n",&input);
printf("input= %f\n",input);

in the output showing ,
satya@localhost programm]$ ./pow
13.0
input= 2.165711
Conversion string for double is %lf not %f.

Savage
May 27 '07 #2

kky2k
P: 34
also remove \n from the scanf statment
May 29 '07 #3

sicarie
Expert Mod 2.5K+
P: 4,677
I have changed the title to better describe your issue - please let me or another moderator know if you think it should be something else.

Also, please read our Posting Guidelines which request you use code tags, create good thread titles, and actually ask a question in your posts. Thanks!
May 29 '07 #4

Post your reply

Sign in to post your reply or Sign up for a free account.