I need to implement the code that manages a chessboard in ppm. It would be in the standard 8x8 format, with the user's option to set the pixels quantity, the doubt would be at the time of looping to "multiply" the pixels. In the code below it is coming out in the 8x8 standard:
#include <stdio.h>
int main()
{
int larg, alt;
larg = alt = 8;
printf("P2\n");
printf("%d\t%d\n", larg, alt);
printf("255\n");
int i, j;
int tamanho = 2;
for(i = 0; i < larg; i++){
for( j = 0; j < alt; j++){
if((i + j) %2 != 0){
printf("0\t");
}
else{
printf("255\t");
}
}
printf("\n");
}
return 0;
}
I hope it has become clear, and I apologize for any possible error, as this is my first question.