fork download
  1. #include <stdio.h>
  2. void main() {
  3. int op;
  4. char ch;
  5. printf("1. Lower to Upper\n2. Upper to Lower\n");
  6. printf("Option: ");
  7. scanf("%d", &op);
  8. printf("Character: \n");
  9. scanf("%c",&ch);
  10. switch(op){
  11. case 1:
  12. if(ch>= 'a' && ch<='z'){
  13. printf("Upper: %c\n",ch);
  14. }else{
  15. printf("Not lower\n");
  16. }
  17. break;
  18. case 2:
  19. if(ch>= 'A' && ch<='Z'){
  20. printf("Lower: %c\n",ch+32);
  21. }else{
  22. printf("Not Upper\n");
  23. }
  24. break;
  25. default:
  26. printf("Invalid\n");
  27. break;
  28. }
  29.  
  30.  
  31. }
Success #stdin #stdout 0.02s 25860KB
stdin
Standard input is empty
stdout
#include <stdio.h>
void main() {
	int op;
	char ch;
	printf("1. Lower to Upper\n2. Upper to Lower\n");
	printf("Option: ");
	scanf("%d", &op);
	printf("Character: \n");
	scanf("%c",&ch);
	switch(op){
		case 1:
	if(ch>= 'a' && ch<='z'){
		printf("Upper: %c\n",ch);
	}else{
		printf("Not lower\n");
	}
		break;
		case 2:
		if(ch>= 'A' && ch<='Z'){
			printf("Lower: %c\n",ch+32);
		}else{
			printf("Not Upper\n");
		}
		break;
		default:
		printf("Invalid\n");
		break;
	}
	
	
}