lundi 1 novembre 2021

My program won't stop executing the if statement yet the condition is not met

It's supposed to be a multiplication table from 1 to 6 on the x axis and 1 to 5 on the y axis, so I have this if statement that is supposed to jump to the nezt line once the multiplication reaches 6 but it keeps on executing even though I reset the condition that is to be met within it.

#include <stdio.h>
#include <stdlib.h>
int main(){
int mult = 1;
int check = 0;
int res;
while(mult != 6){


        if (check <= 6){
            res = mult * check;
            printf("%d ",res);
            check ++;
        }
        if (check > 6 ){
            printf("\n ");
            check = 0;
        }

}}

Aucun commentaire:

Enregistrer un commentaire