Hi Guys,
i´m using codeblocks to practise my C-Skills. Today i noticed that i have an issue. If i try to implement my code:
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
int main()
{
int n= 1234;
int anzahl=4;
int ergebnis;
for (int i=0 ; i<anzahl; i++){
int a= pow(10.0 , 1+i);
ergebnis= n % a;
printf("%d\n\n",ergebnis);
}
codeblock gives me the following result:
4
46
234
1234
The 46 ist wrong. Do anybody know why (The code is correct).
My version: 17.12
thanks in advance.