This (do-While) loop doesn't want to stop despite meeting the condition - CS50-ps1

46 Views Asked by At

What am I doing wrong? it doesn't want to stop. I add printf to many spots to track all the results and they all meet the condition i set for the do-while loop

-CS50

#include <stdio.h>
#include "cs50.h"



int main(void) 
{

 long long i = 0 ; // we must set it to (0), so it's not given a random big number.
 
 


do { 
 long long i = 0 ;
 long long n = get_long_long("Enter the card number:");
 printf("your card:%lli\n",n);

 while (n>0)
{
 n=n/10 ; 
 i=i+1 ; 
 printf("the number now is:%lli\n",n);
 printf("level is:%lli\n",i);
 }

printf("code ended-Digits are:%lli\n",i);


}
while (i>16 || i<13); 
printf("results reached");

}
0

There are 0 best solutions below