How can I get this code to display the first 100 even numbers not multiples of 10?

Asked

Viewed 51 times

-4

#include <stdio.h> 
#include <conio.h> 
int main () { 
  int count; 
     for (count=0;count<200;count=count+2)   
     printf ("%d \t ",count); 
         if (count%10==0)
            {
             count++;  
            }
     getch(); 
return(0);  
}

1 answer

-3


try as follows:

#include <stdio.h> 
#include <conio.h> 

int main () {
int vezes = 0;
for(int count=0; vezes <= 100; count = count+2) {
    if(count%10 != 0) { //não multiplo de 10
        printf ("%d \t ",count);
        vezes++;
    }
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.