like this: ??
program project4;
var num,c,cont:byte;
begin
writeln('entry number');
readln(num);
cont:=0;
Repeat
c:=num div 2 ;
inc(cont);
until c=0;
writeln('number of cycles are ',cont);
end.
but it still doesnt work , it just asks for the number and stops there.
Well lets run it and see what happens
prints on the screen the phrase "entry number" and waits for you to enter a number
you type the number 7 and press enter
assigned the value of 0 to the variable Cont;
starts the loop
calculates the result of Num div 2 and assigns it to the variable C in this case num equals 7 so C becomes 3
increases the value of cont by 1 so now cont has a value of 1;
checks if c equals 0, C has the of 3 as calculated earlier.
jumps back to repeat line for the iteration.
calculates the result of Num div 2 and assigns it to the variable C in this case num equals 7 so C becomes 3
increases the value of cont by 1 so now cont has a value of 2;
checks if c equals 0, C has the of 3 as calculated earlier.
jumps back to repeat line for the iteration.
calculates the result of Num div 2 and assigns it to the variable C in this case num equals 7 so C becomes 3
increases the value of cont by 1 so now cont has a value of 3;
checks if c equals 0, C has the of 3 as calculated earlier.
jumps back to repeat line for the iteration.
calculates the result of Num div 2 and assigns it to the variable C in this case num equals 7 so C becomes 3
increases the value of cont by 1 so now cont has a value of 4;
checks if c equals 0, C has the of 3 as calculated earlier.
jumps back to repeat line for the iteration.
calculates the result of Num div 2 and assigns it to the variable C in this case num equals 7 so C becomes 3
increases the value of cont by 1 so now cont has a value of 5;
checks if c equals 0, C has the of 3 as calculated earlier.
jumps back to repeat line for the iteration.
........
well you get the point I guess. since num is always 7 C wil always be 3 and it will never reach 0 and you have fallen for the most common logical error in programming called infinite loop.
I'm going to give you the chance of coming up with an alternative method to solve the problem if you can't find a solution then ask again presenting the various way to tried to solve the problem and I'll post the answer.
In the mean time here is a hint you need to use the last calculated value from X div 2 instead of always the input value.