468,539 Members | 1,473 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,539 developers. It's quick & easy.

[Error] redefinition of 'int main'

I encountered a problem when running C program. How to solve that problem. I use Dev-C++ 5.11

Code here:

#include <stdio.h>

int stringCount(int n){
int count = 0;
while(n >= 10){
n /= 10;
count++;
}
return count;
}

int stringEnd(int n)
{
return n % 10;
}

int main()
{
/* @function : dem chu so
* @var : int n
* @return : stringCount, stringEnd
*/
int n;
printf("Nhap so tu nhien n : ");scanf("%d", &n);
if(n > 0){
printf("So luong chu so cua so tu nhien %d la %d", n, stringCount(n)+1);
printf("\nChu so cuoi cung la : %d ", stringEnd(n));
}else{
printf("Ban phai nhap 1 so > 0");
}
return 0;
}
Oct 24 '19 #1
1 1939
dev7060
436 Expert 256MB
The code has no compilation errors. I tested it in Dev-C++ 5.11 as well. Post your screenshots.
Oct 24 '19 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

10 posts views Thread by Frederick Ding | last post: by
37 posts views Thread by Army1987 | last post: by
15 posts views Thread by macaireb | last post: by
reply views Thread by NPC403 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.