fork download
  1. #include <stdio.h>
  2.  
  3. void myToUpper(char s[]){
  4. int i;
  5. for(i=0;s[i]!='\0';i++){
  6. if('a'<=s[i]&&s[i]<='z'){//小文字と判定されるかの分岐
  7. s[i]=s[i]-32;//小文字と判定された文字をすべて大文字に変更
  8. }
  9. }
  10. return;
  11. }
  12. int main(void) {
  13. // your code goes here
  14. char s[100];
  15. scanf("%s",s);//文字列sの入力
  16. myToUpper(s);
  17. printf("%s",s);//関数から帰ってきたすべて大文字の文字列を表示
  18. return 0;
  19. }
  20.  
Success #stdin #stdout 0s 5324KB
stdin
abcd
stdout
ABCD