473,407 Members | 2,629 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,407 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 5631
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 source code on the internet and use it as long as...
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 help me finding the reason why this rabish is being...
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 getting me started is appreciated. I'm having trouble...
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 program to work. I really desperately need help! My...
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 Enter a number : 25 More numbers (y/n)? y...
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 segment, TEXT segment, BSS segment etc. I am working...
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 file with student ID, 5 program scores, midterm and...
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 tonight...i will pay $5 if you accept to do it and...
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
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
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
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
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...

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.