472,353 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

writing a program in C to calculate delta between two numbers

I'm a very new programmer.
I have a sorted file and want to calculate delats between the numbers. That is calculate the difference between first number in line 1 and second number in line 2 (delata1), difference number 3 in line 3 and number 2 in line 2(delta2), .... so on.
Then calculate mean of these deltas, variance, standard dev and then ratio standard dev to mean (stand dev/mean).
Can have any sample/example files.
Thanks for your help
Moshiur
Mar 1 '07 #1
6 5411
Ganon11
3,652 Expert 2GB
Well, in order to do that, you'd have to read in the first 2 numbers, then subtract them and store this value into your delta array. You should have 2 integer values (for the two numbers to subtract) and an integer array (for the delta values). You can write a loop to continue finding delta values for the entire file, storing them into the array.
Mar 1 '07 #2
any sample file you can share with me?
Mar 1 '07 #3
sicarie
4,677 Expert Mod 4TB
any sample file you can share with me?
We are not allowed to write your homework for you, but if you try it and get stuck, we will help you if you post the portion of code that is returning the error, and explain what you have done to try to fix it.
Mar 1 '07 #4
Ganon11
3,652 Expert 2GB
Do you mean a sample file filled with numbers in ascending order? I think we can do that, since he'd still have to write all the code himself...
Mar 1 '07 #5
Yes, sample file fiiled with numbres in asscending order
Mar 1 '07 #6
Ganon11
3,652 Expert 2GB
OK, try

5 7 9 11 14 19 40 50 51 60

10 random numbers I picked off the top of my head.
Mar 2 '07 #7

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

Similar topics

1
by: GM | last post by:
Hello. I am starting my 7th week of an intro to programming class and have a problem I have been working on. My instructor said we could look for...
6
by: hpy_awad | last post by:
I am writing stings ((*cust).name),((*cust).address)to a file using fgets but rabish is being wrote to that file ? Look to my source please and...
5
by: cj | last post by:
Thanks to everyone that has helped me. Now I'm trying to write my first program. I have an example of one that I need to write about. Any help...
1
by: Willing 2 Learn | last post by:
Below is a program I did to recognize a Finite State Automata for ASCII (J+H)*. I got that one working but im having trouble getting the NFA...
9
by: ehabaziz2001 | last post by:
I am facing that error message with no idea WHY the reason ? "Abnormal program termination" E:\programs\c_lang\iti01\tc201\ch06\ownarr01o01...
9
by: Hemal | last post by:
Hi All, I need to know the memory required by a c program. Is there any tool/utility which can give me the memory usage in terms of DATA...
0
by: lavicool | last post by:
Hi all, I just joined the post. Iam new to C programming. I have a question regarding a problem for my assignment. The problem is i have a input...
7
by: rohitsripathi | last post by:
i need help writing this program... i am in college and i do not have time do this right now as i need to study for another test....but this is due...
6
by: rahulsengupta895 | last post by:
. #define MIN(a,b) (a<b?a:b) #define MAX(a,b) (a>b?a:b) #include "Video.h" #define NO_HUE -1
1
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: Matthew3360 | last post by:
Hi there. I have been struggling to find out how to use a variable as my location in my header redirect function. Here is my code. ...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

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.