473,327 Members | 1,920 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

the following code does not accepts floating number and i want input in same order

Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. int r;
  6. char g;
  7. float p;
  8. clrscr();
  9. printf("enter your rollno.");
  10. scanf("%d",&r);
  11. printf("enter your grade");
  12. fflush(stdin);
  13. scanf("%c",&g);
  14. printf("enter your percentage\n");
  15. scanf("%f",&p);
  16. printf("your rollno.is %d\n",r);
  17. printf("your grade is %c\n",g);
  18. printf("your percentage is %f",p);
  19. getch();
  20. }
  21.  
Oct 1 '10 #1
1 1156
donbock
2,426 Expert 2GB
Compare lines 7 and 15. I believe the "%f" format in scanf requires a double argument, not a float. Same for line 18 and printf.
Oct 1 '10 #2

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

Similar topics

10
by: Nick L | last post by:
I'm working on a function which creates a pointers to an array of unsigned ints based off a number read from a file. I then continue to read file names from the file, convert the name to a char*...
15
by: | last post by:
The data file is a simple Unicode file with lines of text. BCP apparently doesn't guarantee this ordering, and neither does the import tool. I want to be able to load the data either sequentially...
6
by: leonat | last post by:
I have an asp.net webform. When I view the page in the web browser, the html is returned but not any asp code, i.e., " <% ... %> ". This same code works in the "old" asp page BUT NOT in...
0
by: Just Me | last post by:
What's wrong with the following code? The TempName read is valid since I just wrote it and also did a QuickWatch to check it. But once I set the PrinterName the count of papersizes goes to zero. ...
8
by: Stefan Mueller | last post by:
I'm really very confused. With the following code I can add rows/fields in frame 1 and 2. If I use IE, Mozilla or Opera the new rows/fields get added in ascending order. However, if I use Safari...
6
by: mahesh | last post by:
Hi friend, I am in deep trouble, I need to change the string in following format " 1.55576+2" in the floating point notation. that is i should have 155.576 as my output. Please suggest some...
0
by: gwelcom | last post by:
Hi all... I need Stored procedure in db2 which accepts any number of Arguments. The criteria is the various arguements may be integer,varchar,decimal. Regards, Sampath
7
by: pltmcs | last post by:
I have a form that keeps track of keys given to employees. We decided to add a feature to keep a digital signature for the keys so I created a second table to hold the signature and enough...
16
by: Peng Yu | last post by:
Hi, I'm wondering if there is a min function (in boost, maybe?) that accepts any number of arguments? std::min only accepts two arguments. If I want to get the minimum number out of many, I have...
5
by: nirmal1349 | last post by:
Hi, I have a hash in hash file in perl which looks some thing like this: $FIELDS = { 'abc' => { 'Description' => { 'Purpose' => 'some data is present',...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.