zzulioj 1024: Calculate alphabetical number

Title description
Enter an English letter (may be uppercase or lowercase), and output the serial number of the letter in the alphabet (the serial number of'a' and'A' is 1).
Input
Input only one English letter.
Output
Output an integer, which represents the serial number of the letter in the alphabet, and the output occupies a single line.
Sample input Copy
D
sample output Copy
4
prompt
...

#include<stdio.h>
int main()
{
    
    
	char ch;
	ch=getchar();
	if(ch>='a')
	  printf("%d\n",ch-96);
	  else
	    printf("%d\n",ch-64);
	return 0;
}

Guess you like

Origin blog.csdn.net/m0_53024529/article/details/112741951