-
Help Please.
I am an absolute beginner to C programming.
I need help with this program. Please help. Thanks in advance.
Here is the problem.
Enter a float number. Print the last digit of the integer part of the number.
Below is the code I wrote. But I am getting an error saying "syntax error before int"
Code:
#include <stdio.h>
#include <conio.h>
void main()
{
float a;
int b,last;
printf ("value: ");
scanf ("%f", &a);
b = int(a);
last = b%10;
printf ("%d", last);
getch();
}
-
Your casting syntax is wrong. should be
-
also it should be
int main(void) - read FAQ
conio.h and getch are not standard -
remove line:
#include <conio.h>
and replace getch with getchar
-
Thanks Guys.
Works Now :-)