Thanks for your replys. I've updated the program and now have partial success.

Code:
int main(void){

    int  i=0,a;
    char sent[100];
    while(scanf("%d",&a) != '0'){
                
            fgets(sent,sizeof(sent),stdin);
            
            for(i=0;sent[i];i++){
                if(sent[i] == ' ')
                  sent[i] = ' ';
                else if((sent[i] + a) > 'Z')
                  sent[i] = 'A' + ((sent[i] + a) - 'Z')-1;
                else
                  sent[i] += a;
                  }
            printf("%s\n",sent);
                       
            }
    
    return 0;
    }
I have a few problems.

When I put in a 0, the program should quit the loop and end, but in the output it just seems to skip a line and continue working.

When I put in a number, it automatically interprets it and then waits for the next input (which is the only thing that should be interpreted..

The encoding part works though. The program assumes only capital letters will be used.