# include <stdio.h>
# include <conio.h>
int main ()
{
int x,cont=0;
char opcion;
printf("Introduzca el numero deseado: ");
scanf ("%d",&x);
do {
printf("Introduzca la operacion deseada: \n a. Pares \n b. Impares \n c. Todos \nElige opcion: ");
fflush(stdin);
scanf("%c",&opcion);
if (opcion!='a'&& opcion!='b'&& opcion!='c')
{
printf("Error opcion no valida. Seleccione a. b. o c.");
}
else
{
}
}
while (opcion=='a'||opcion=='b'||opcion=='c');
{
switch((char)opcion)
case 1: case 'a':
cont=0;
if (x%2!=0)
{
x=x + 1;
printf ("%d",x);
cont ++;
}
else
while(cont<9)
{
x=x+2;
printf("%d",x);
cont ++;
}
break;
case 'b':
cont=0;
if (x%2==0)
{
x=x + 1;
printf ("%d",x);
cont ++;
}
else
{
}
for (; cont<9;cont ++)
x=x+2;
printf ("%d",x);
break;
case 'c':
{
cont=0;
for (; cont<10;cont ++)
x=x+1;
printf ("%d",x);
cont ++;
break;
}
getch ();
return 0;
}
}
Gracias por adelantado.Buenos dias.
