Untitled

mail@pastecode.io avatar
unknown
plain_text
3 years ago
701 B
2
Indexable
Never
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

void num_to_letter(int a);

int main(void)
{
    int stu_id = 70357003;

    int num_input;
    printf("Input a series of integers separated by a space: ");

    while(scanf("%d", &num_input)){
        char ch = getchar();
        if(num_input >= 1 && num_input <= 26){
            num_to_letter(num_input);
        }
        else{
            printf("Please input integers from 1 to 26 only.\n");
        }
        if(ch == '\n'){
            printf("\n\nStudent ID: %d\n\n", stu_id);
            return 0;
        }
    }
}

void num_to_letter(int a){
    int num_code = a + 96;
    printf("%c", num_code);
}