473,396 Members | 2,092 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,396 software developers and data experts.

getting statement not reached at z=s;

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
double mycos(double x,double err)
{
double i,r,c,z,s,t,a,n;
s=1;c=2*n;n=1;
while(2>1){
{for(i=1,a=1;i<=c;++i){a=a*i;}}
t=pow(-1,n)*(pow(x,c)/a);
s=s+t;
++n;
}
z=(s);return (z);
}
int main()
{
double err,x,a,r,c,t,i,z;
printf("give x");
scanf("%lf",&x);
z=mycos(x,err);
printf("%lf",z);
}
Aug 20 '14 #1
1 1320
weaknessforcats
9,208 Expert Mod 8TB
This code:
Expand|Select|Wrap|Line Numbers
  1. while(2>1){
  2.  {for(i=1,a=1;i<=c;++i){a=a*i;}}
  3.  t=pow(-1,n)*(pow(x,c)/a);
  4. etc...
2 is always greater then 1. You never leave the while loop.
Aug 20 '14 #2

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

Similar topics

7
by: Graham James Campbell CS2000 | last post by:
Having a nightmare problem with this and would appreciate any and all help. The situation is I want to move from a webform and format the user inputted text into some html I am storing in a...
4
by: Frank | last post by:
Hello, how to get information about all serial ports in the PC? I use the following code, but i got only the data of the FIRST serial port. All other serial port information are not available...
43
by: dev_cool | last post by:
Hello friends, I'm a beginner in C programming. One of my friends asked me to write a program in C.The purpose of the program is print 1 to n without any conditional statement, loop or jump. ...
13
by: axr0284 | last post by:
Hi, I have a main function as follows: int main(void) { while(TRUE) { ... } return TRUE; } my question is since the return TRUE is never reached, can I remove
1
by: jobs | last post by:
Re: Troubleshooting Timeout expired. All pooled connections were in use and max pool size was reached. New webservers. win2003. IIS6. asp.net 2.0/ sql server 2005 and Oracle 9i through a 64 bit...
1
by: sri6412 | last post by:
I am trying to get the user details from the database, the request handler is in execution, but mean while i would like to verify the timeout value. Once request processing reached timeout value,...
2
by: rbalakrishnan | last post by:
Hi All i am working to fix all warning messages in my c code. i am getting "statement not reached" warning.How can i resolve it? please give me some tips to resolve this warning. Thanks in...
16
by: cmdolcet69 | last post by:
I have the below if statement, that should catch if any of the conditions are met.....however for some reasons if my boolDSIFlushGapReading = true and MuxClass.DSIValues.count =1 and my...
4
by: flibberdee | last post by:
I keep getting this error when I try to build my project. I have checked I have two opening { and two closing }. I cant for the life of me figure out what is wrong with this code. I am fairly new to...
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
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,...

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.