#include<stdio.h>
#include<windows.h>
int main ()
{
int count=1;
while(count<=4)
{
printf( "%s\n", count % 2 ? "****" : "++++++++" );
contador++;
}
system("pause");
return 0;
}
In this example ¿why I don't need define contador==0 or contador==1? I realized a translation using if and else
my translate is ;
#include<stdio.h>
#include<windows.h>
int main ()
{
int count=1;
while(count<=4)
{
if (count%2==1);
printf("****");
else
printf("+++++");
}
system("pause");
return 0;
}
Neodimio58:
In this example ¿why I don't need define contador==0 or contador==1? I realized a translation using if and else
my translate is ;
You can use numerical values in statements that expect a true/false value like if and while statements. In those cases, 0 is treated as false and all other numbers are treated as true.