469,929 Members | 1,433 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,929 developers. It's quick & easy.

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 5029
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

Post your reply

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

Similar topics

1 post views Thread by GM | last post: by
5 posts views Thread by cj | last post: by
1 post views Thread by Willing 2 Learn | last post: by
9 posts views Thread by ehabaziz2001 | last post: by
9 posts views Thread by Hemal | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.