473,325 Members | 2,860 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,325 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 1318
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
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
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.