By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
439,971 Members | 1,467 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 439,971 IT Pros & Developers. It's quick & easy.

[Error] redefinition of 'int main'

P: 1
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
Share this Question
Share on Google+
1 Reply


100+
P: 142
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.