I can’t run c program in replt only. the code I’m trying to run in replit it works another editor
int sum, mul, sub;
float num1, num2, div;
printf("Give two integers: ");
scanf("%f %f", &num1, &num2);
sum = num1 + num2;
sub = num1 - num2;
mul = num1 * num2;
div = num1 / num2;
printf("%.0f + %.0f = %d\n", num1, num2, sum);
printf("%.0f - %.0f = %d\n", num1, num2, sub);
printf("%.0f * %.0f = %d\n", num1, num2, mul);
printf("%.0f / %.0f = %.2f", num1, num2, div);
As the error says , you have two mains in two different files.
Rename the one you do not need into something else like main_old
Thank you very much for your quick response. I want to work with file and folders on replit for better organize. How to run an individual file in an individual folder. like:
File-1 > program-1.c I want to run it individually
File-2 > program-2.c I want also run it individually
When I create and run files like this, that errors occurs please help me. Thanks
Well, C only allows for one main when you compile it.
So you need to compile the programs separately, I would compile by hand in the shell with the -c filename option
Thanks for your help. I’m working according to your instructions and understood. This program crashed here but works another well. Why so much errors in replit.
I added an image and showed my errors I’m facing. Thank you.
i tried and it is working in my case (not on replit)
How I can run on replit? Could you help?
For me it works. Without issues also on replit.