Hey guys... I keep getting an error(Error 26: Type Mismatch) in line 19(Until num='';) and I don't know how to fix it... Can you guys please assist me.....Thanks....

program sequence;

uses wincrt;

var  num,count_zero,count_non_zero:integer;

Begin

     count_non_zero:=0;
     Repeat
     writeln('Enter a number');
     readln(num);
     IF num=0 then
        count_zero:=count_zero+1
     Else
         count_non_zero:=count_non_zero+1;
     writeln('Non Zero Count: ',count_non_zero);
     writeln('Zero count: ',count_zero);
     Until num='';
End.

Recommended Answers

You are comparing a number with a string. Try Until num=-1 or something like that.

Jump to Post

All 2 Replies

You are comparing a number with a string. Try Until num=-1 or something like that.

I think that he wants when the line is empty and he press enter to go out of cycle so it will be better to be

Until num=#13;
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.19 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.