#include<stdio.h>
#include<ctype.h>
#include<stdbool.h>
#define N 80
int main(void)
{
char str[N] = { 0 };
char ch;
int n;
printf("Enter shift amount: ");
scanf_s("%d", &n);
printf("Enter message to be encrypted: ");
ch = getchar();
for (int i = 0; i < N && (ch = getchar()) != '\n'; i++)
{
if (isalpha(ch) == false)
{
str[i] = ch;
}
else
{
if (isupper(ch)==true)
{
str[i] = ((ch - 'A') + n) % 26 + 'A';
}
else
{
str[i]= ((ch - 'a') + n) % 26 + 'a';
}
}
}
printf("Encrypted message: ");
for (int i = 0; i < N && str[i] != 0; i++)
{
putchar(str[i]);
}
return 0;
}