// Arup Guha
// 8/21/2025
// Sample Code to show how to deal with characters in encryption/decryption

#include <stdio.h>
#include <string.h>
int main() {

    char plain[100];
    printf("Enter plaintext all uppercase letters.\n");
    scanf("%s", plain);

    printf("Enter a, b for encryption.\n");
    int a, b;
    scanf("%d%d", &a, &b);
    char cipher[100];

    int len = strlen(plain);

    // Go to each letter.
    for (int i=0; i<len; i++) {

        // Here we can do the math without extra functions, just subtract 'A' to get numeric value.
        int numcipher = (a*(plain[i] - 'A') + b)%26;

        // Add 'A' back in before storing in characer.
        cipher[i] = numcipher + 'A';
    }

    // Null terminate string.
    cipher[len] = '\0';

    printf("%s\n", cipher);

    return 0;
}
