473,386 Members | 1,712 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,386 software developers and data experts.

how to combine this? help plz..

9
Expand|Select|Wrap|Line Numbers
  1. #include<stdio.h>
  2. #include<math.h>
  3.  
  4. int main(void)
  5. {
  6.     float x;
  7.     float k,result,sum;
  8.     float result2,sum1=0;
  9.     float x1;
  10.     int i,n;
  11.  
  12.     printf("Please enter a value of x:");
  13.     scanf("%f",&x);
  14.  
  15.   if(x>0&&x<=2)
  16.  
  17.     {result= sum+log10(x);
  18.     sum=0;
  19.  
  20.     printf("%f",result);}
  21.  
  22.  
  23.     else{
  24.     printf("Please enter a value that more than 0 and less or equall than 2.");
  25.     }
  26.  
  27.  return 0;
  28. }
  29.  
i want to insert this into above program because i want to print 2 different result..
how to do it? ive tried many times but it always error at the else.

Expand|Select|Wrap|Line Numbers
  1. x1 = (x - 1);
  2.  
  3. for( i = 1; i < n; i++)
  4. {
  5. k = ( (pow((x-1), (i+1)) )/ (i+1) );
  6. if( ((i+1) % 2) == 0)
  7. x1 -= k;
  8. else
  9. x1 += k;
  10.  
  11. result2=(sum1+x1)/2.303;
  12. }
  13.  
  14. printf("%f",result2);
  15.  
Oct 9 '09 #1
3 1350
Banfa
9,065 Expert Mod 8TB
Do you mean you get a compile error on that line? If so post the errors.
Oct 9 '09 #2
donbock
2,426 Expert 2GB
I don't really understand what you're trying to insert or where you want to insert it. You say you get errors at the else; what are those errors?
Oct 9 '09 #3
myusernotyours
188 100+
Oh yes. And please do use code tags when you are posting code. It's so much more easier on the eyes.

Regards,

Alex.
Oct 9 '09 #4

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

Similar topics

3
by: Nick | last post by:
I am working a new application...well actually a series of applications for my company. They want internal users to be able to go to a site and everything regarding security is transparent,...
1
by: William Stacey [MVP] | last post by:
I need a bullet proof way to combine a root and a relative path to form a FQ rooted path (similar to a VDir in IIS). Path.Combine alone will not do the job in all cases. I also need to be sure...
1
by: David Lozzi | last post by:
Hello, I'm looking for the best option to combine two XMLDocuments into a single document. I'm using ASP.Net using VB. I have a function that returns a dataset in XML which works great if there...
5
by: jhutchings | last post by:
Hello everyone, I have a database where I collect shipment data from various tables. However, I have a problem. Whenever I want to see shipping data for orders that were set to ship on or before...
3
by: Schroeder, AJ | last post by:
Hello group, I am a relative PHP newbie and I am trying to combine two arrays together, but I also need to keep the keys of one array intact. What I am doing is two SNMP walks against a Cisco...
2
by: nugz | last post by:
I want to combine 3 tables with like data then append it with a filter. Tables: NewStarts, Complaints, Memos Combine: Date, Address, Route, Pub, etc.... Then sort: previous 8 days, pub/freq...
3
by: Steven Bethard | last post by:
Within a larger pyparsing grammar, I have something that looks like:: wsj/00/wsj_0003.mrg When parsing this, I'd like to keep around both the full string, and the AAA_NNNN substring of it, so...
5
by: Rodjk #613 | last post by:
Hello, I am working with a database that is in use in several locations. The structure of the databases are identical, but the data is different. I am tasked with combining the data into one...
1
by: bluereign | last post by:
Thank you for your assistance. I am a novice looking to JOIN and append or combine records from 2 current Tables into 2 new Tables named below. I have been able to JOIN Tables with the script...
1
by: LSGKelly | last post by:
Hi all. I need to combine two fields that contain numbers that are in a currency format (Ex: $1,500 $3,500). When I combine them, I want them to look like this -- $1,500/$3,500. When I combine...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.