I hava an programm, and it runs perfect, exept above input of 33000 it doesnt work anymore. This is because my input is an int so the solution is to make it an float, but when i do this the programm doesn't do what i want
note: input = nInvoer
Code:
/* INCLUDES: */#include <stdio.h>
#include <stdlib.h>
#include <conio.h>
#include <string.h>
#include <math.h>
/* MAIN PROGRAM: */
int main(void)
{
int nInvoer;
int nIndex;
int i;
int nGetalgevonden;
char chE12[12] = {10,12,15,18,22,27,33,39,47,56,68,82};
char chAgain = 'y';
while(chAgain=='y')
{
nGetalgevonden=2;
printf("Voer een getal in\n") ;
scanf("%d", &nInvoer);
if (nInvoer <100)
{
for( nIndex =0; nIndex<12; nIndex++)
{
if (nInvoer == chE12[nIndex])
{
nGetalgevonden=1;
}
}
}
else
{
for (i=0; i<5; i++)
{
nInvoer=nInvoer/10;
for( nIndex =0; nIndex<12; nIndex++)
{
if (nInvoer == chE12[nIndex])
{
nGetalgevonden=1;
}
}
}
}
if (nGetalgevonden==1)
{
printf("getal zit in de e12 reeks\n");
}
else
{
printf("getal zit niet in de e12 reeks\n");
}
printf("Do you want to run this program again? [y/n]:\n ");
chAgain = getche();
}
return(0);
}