473,473 Members | 1,818 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Too few arguments for format.

27 New Member
When I compile this I get the "too few arguments for format for both of my printf statements following my equations. Why is this? and as well it says there is an error in the first equation I have created.


Expand|Select|Wrap|Line Numbers
  1.  
  2. #include <stdio.h>
  3. #include <math.h>
  4.  
  5.  
  6.  
  7. int main(void)
  8.  
  9. {
  10.  
  11. double escape;
  12. double radius;
  13. double mass;
  14. double grav;
  15. int num;
  16. int cont;
  17.  
  18. do
  19. {
  20.  printf("Please select 1. Select 2: ");
  21.  scanf("%d",&num);
  22. }while((num!=1)||(num!=2));
  23.  
  24.  
  25.  if(num==2)
  26. do
  27. {
  28. printf("Please enter the mass of the planet: ");
  29. scanf("%lf", &mass);
  30.  
  31. printf("Please enter the radius of the planet: ");
  32. scanf("%lf", &radius);
  33.  
  34. escape=sqrt((2*pow(6.67428*10,-11)*mass)/radius));
  35.  
  36. printf("The escape velocity of this planet will be: %.5f\n");
  37.  
  38. grav=(((mass/pow(5.9736*10,24))/(radius/6371000)));
  39.  
  40. printf("The gravity factor of this planet is: %.5f\n");
  41.  
  42. printf("Plese select 1 to calculate for another planet: ");
  43. scanf("%d", &cont);
  44. }while(cont==1);
  45.  
  46.  
  47.   return(0);
  48. }
  49.  
Apr 2 '10 #1
2 7542
abrown07
27 New Member
sorry , answered myself stupid question forgot to include ,grav and ,escape.

could still use the help on the error in my formula though!
Apr 2 '10 #2
whodgson
542 Contributor
*10 on l 34 ...should delete
ditto l 38
Apr 2 '10 #3

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

Similar topics

3
by: Trevor M. Lango | last post by:
The number of arguments passed to the following functions can be determined - but how is this coded? main (int argc, char *argv) printf ( string format ) I would like to be able to write...
6
by: Melkor Ainur | last post by:
Hello, I'm attempting to build an interpreter for a pascal-like language. Currently, I don't generate any assembly. Instead, I just build an abstract syntax tree representing what I've parsed...
10
by: The Directive | last post by:
I read the C FAQ question on passing a variable number of arguments, but it didn't help. The example assumes all arguments are of the same type. I want to create a function "trace" that can be...
4
by: Peter Ammon | last post by:
Does anyone ever write the arguments to printf()-like functions under the corresponding format specifier? printf("My name is %s and I am %u years old\n", name, age); If the arguments...
3
by: Eli Criffield | last post by:
I'm getting odd results from my fuction that takes variable aguments. What i want to do is take a printf like format and pass that to mysql_query then i do some processing of the results and...
2
by: asdf | last post by:
fscanf(fp,"\n", &intensity); will generate the following warning: warning: too many arguments for format how to fix it ? Thanks a lot.
6
by: rashmi | last post by:
Hello All, Can we map a MACRO with variable number of arguments to a function with variable number of arguments? Please help me in finding out how this could be done ? for eg: #define...
2
by: Spoon | last post by:
Hello everyone, AFAIU, in C89, calling fprintf with too few arguments leads to UB. 4.9.6.1 The fprintf function Synopsis #include <stdio.h> int fprintf(FILE *stream, const char *format,...
11
by: Gary James | last post by:
I'm using an object data type variable to pass a numeric value (Int, Float, Double, etc) to a function that returns a formatted string. However, nullable types do not provide an overridden...
18
by: squaretriangle | last post by:
Is it possible through some trickery, perhaps using the methods of stdarg, to pass a dynamic (unknown at compile time) number of arguments to a function? For example, I want to enumerate an array...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.