Hello there. I've a problem. I've a code and it works on my linux laptop; however it doesnt work on a matrix server. Im getting error
Code:
file.c: In function ‘CondCheck’:file.c:40:3: warning: this decimal constant is unsigned only in ISO C90 [enabled by default]
The code of the programme
Code:
#include <stdio.h>
#include <string.h>
#include <math.h>
/*DECIMAL TO BINARY CONVERTER*/
int BinaryConverter (int bina)
{
int i =0; //Thecounter
double co = 2147483647;
for (i=0; i<32; i++)
{
if(bina>=co)
{
printf("1");
bina=bina-co;
}
else
printf("0");
co=co/2;
/*THE SEPARATOR*/
if (i == 7 || i == 15 || i == 23)
printf(" ");
}
printf("\n");
i=0;
}
/*THE CONDTION*/
int CondCheck (int error)
{
while (error < 0 || error > 2147483648)
{
printf("\n*** This number is not a valid number, try again ***");
scanf("%d", &error);
}
}
/*THE FIBONACHI NUMBERS*/
int fibonacci (int i, int num2)
{
int sum, counter2;
sum, counter2 =0;
while (counter2 < 8)
{
sum=i+num2;
if (counter2 == 7)
printf("%d", sum);
else
printf("%d,", sum);
i=num2;
num2=sum;
counter2++;
}
}
/*THE 30th Fibonachi VALUE*/
int TheThirty (int i, int num2)
{
int sum, counter2;
sum, counter2 =0;
while (counter2 < 29)
{
sum=i+num2;
i=num2;
num2=sum;
counter2++;
}
return sum;
}
/*THE BODY*/
main()
{
int choice, binary, number1, number2;
printf("\nWELCOME TO THE IPC144 MATH UTILITY (by: Anton Elistratov)");
printf("\n1.) Integer to Binary converter");
printf("\n2.) Fibonacci generator");
printf("\n999.) Exit");
printf("\nEnter selection ---> ");
scanf("%d", &choice);
printf("\n");
while (choice != 999)
{
while (choice != 1 && choice != 2 && choice != 999)
{
printf("\n***This is not a valid selection, try again *** ");
scanf("%d", &choice);
}
switch(choice)
{
/*BINARY CONVERTION*/
case 1:
printf("\nEnter a number between 0 and 2147483647 inclusive: ");
scanf("%d", &binary);
CondCheck(binary);
BinaryConverter(binary);
break;
case 2:
printf("Enter first number: ");
scanf("%d", &number1);
printf("Enter second number: ");
scanf("%d", &number2);
while (number1 > number2)
{
printf(" Second number must be greater then first number.\n");
printf("Enter first number: ");
scanf("%d", &number1);
printf("Enter second number: ");
scanf("%d", &number2);
}
printf("%d,", number1);
printf("%d,", number2);
fibonacci(number1, number2);
printf("Fib [30, {%d,%d}] = %d", number1, number2, TheThirty(number1, number2));
break;
default:
printf("\nDefaul in the case\n");
break;
}
printf("\nWELCOME TO THE IPC144 MATH UTILITY (by: Anton Elistratov)");
printf("\n1.) Integer to Binary converter");
printf("\n2.) Fibonacci generator");
printf("\n999.) Exit");
printf("\nEnter selection ---> ");
scanf("%d", &choice);
printf("\n");
}
}
Im just a begginer. What I should do to solve this error?