CASE CHECKER
Problem Description
"Create a method is_uppercase() to see whether the string is ALL CAPS. For example:
Corner Cases
For simplicity, you will not be tested on the ability to handle corner cases (e.g. ""%*&#()%&^#"" or similar strings containing alphabetical characters at all) - an ALL CAPS (uppercase) string will simply be defined as one containing no lowercase letters. Therefore, according to this definition, strings with no alphabetical characters (like the one above) should return True.
- CODING ARENA::
#include <stdio.h>
#include<string.h>
int main()
{
char arr[100];
int i,x,c=0;
scanf("%s",arr);
x=strlen(arr);
for(i=0;i<x;i++)
{
if(arr[i]>='a' && arr[i]<='z')
{
printf("false");
c=0;
break;
}
else
c=1;
}
if(c==1)
printf("true");
return 0;
}
Test Case 1
Input (stdin)HELLO I AM DONALD
Expected Output
true
Test Case 2
Input (stdin)ACSKLDFJSgSKLDFJSKLDFJ
Expected Output
false
No comments:
Post a Comment