#include <stdio.h>
int main()
{
printf ("Introduce un número: ");
int n;
scanf ("%d", &n);
printf ("%d\n", n);
int resto;
int contador=0;
printf ("Los números impares son: ");
for (int i=1; i<=n; i++)
{
resto=i%2;
if (resto!=0)
{
printf ("%d ", i);
contador++;
}
}
printf ("\n");
printf ("Total de números impares: %d\n", contador);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: