I'm getting NAN out of nowhere
Binarydepth via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Mon Apr 10 11:07:44 PDT 2017
On Saturday, 11 July 2015 at 16:57:55 UTC, flamencofantasy wrote:
> On Thursday, 9 July 2015 at 15:14:43 UTC, Binarydepth wrote:
>> This is my code :
>> import std.stdio : writeln, readf;
>> void main() {
>> int[3] nums;
>> float prom;
>> foreach(nem; 0..2) {
>> writeln("input a number : ");
>> readf(" %d", &nums[nem]);
>> prom+=nums[nem];
>> }
>> writeln(prom/3.0);
>> }
>>
>> I get prompted two times for a number and I then get NAN out
>> of nowhere.
>
> foreach(nem; 0..3)
Yes, Thank you!!
More information about the Digitalmars-d-learn
mailing list