Advertisement
hamaXD

CPT lab01-01

Aug 26th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.38 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3.  
  4. int main(){
  5.     char ch ;
  6.     int i=0,num;
  7.     while (1){
  8.        
  9.         printf("Char: ");
  10.         scanf("%c",&ch); fflush(stdin);
  11.         if(ch>='a'&&ch<='z'){
  12.             num = ch-96;
  13.             printf("%d\n",num);
  14.         }else if(ch>='A'&&ch<='Z'){
  15.             num = ch-64;
  16.             printf("%d\n",num);
  17.         }
  18.         else{
  19.             break;
  20.         }
  21.        
  22.     }
  23.     printf("End\n") ;
  24.     return 0;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement