This is a simple program which adds digits of a given number
#include <stdio.h>
#include <conio.h>
void main()
{
float sum = 0, num;
printf("Enter any number\n");
scanf("%f", num);
while(num!=0)
{
sum = sum + (num%10);
num = num/10;
}
printf("Addition of digits of %d is %d", num, sum);
getch();
}
It throws me this error
In function 'main': error: invalid operands to binary % (have 'float' and 'int') idk why I tried to understand but there's no error and it doesn't print string which I have entered