online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/* Jyothisai_k(N190375) Floor function & ceiling function */ #include<stdio.h> #include<string.h> #include<ctype.h> char a[50]; void floor1(char[]); void ceiling(char[]); int neg(char[]); int cond(char[]); int main() { printf("Enter number: "); LOOP: scanf("%s",a); if ( !cond(a) || !neg(a)) { printf("Enter valid number: "); // repeated '.' and '-' goto LOOP; } for(int k=0;k<strlen(a);k++) { if(!isdigit(a[k]) && a[k]!='.' && a[k]!='-') { printf("Enter valid number: "); // if entered number is of not integer type goto LOOP; } } if(a[0]!='-') { printf("\n floor function of %s is ",a); floor1(a); printf("\n ceiling function of %s is ",a); ceiling(a); } else { printf("\n floor function of %s is ",a); ceiling(a); printf("\n ceiling function of %s is ",a); floor1(a); } } void floor1(char a[]) { int i=0; char b[50]; while(a[i]!='.' && i< strlen(a)) { b[i]=a[i]; i++; } b[i]='\0'; printf("%s",b); } void ceiling(char a[]) { int i=0; char b[50]; while(a[i]!='.' && i< strlen(a)) { b[i]=a[i]; i++; } if(i!=strlen(a)) { i--; b[i]=a[i]+1; i++; } b[i]='\0'; printf("%s",b); } int cond(char a[]) { int point=0; for(int i=0;i<strlen(a);i++) { if(a[i]=='.') { point++; if(point==2) { return 0; break; } } } return 1; } int neg(char a[]) { for(int i=1;i<strlen(a);i++) { if(a[i]=='-') { return 0; break; } } return 1; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue