結果

問題 No.163 cAPSlOCK
ユーザー Tsu0664
提出日時 2015-05-14 00:39:33
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 335 bytes
コンパイル時間 96 ms
コンパイル使用メモリ 20,224 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-06 03:32:01
合計ジャッジ時間 843 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:12:20: warning: implicit declaration of function ‘toupper’ [-Wimplicit-function-declaration]
   12 |             s[i] = toupper(s[i]);
      |                    ^~~~~~~
main.c:2:1: note: include ‘<ctype.h>’ or provide a declaration of ‘toupper’
    1 | #include <stdio.h>
  +++ |+#include <ctype.h>
    2 | 
main.c:14:20: warning: implicit declaration of function ‘tolower’ [-Wimplicit-function-declaration]
   14 |             s[i] = tolower(s[i]);
      |                    ^~~~~~~
main.c:14:20: note: include ‘<ctype.h>’ or provide a declaration of ‘tolower’
main.c:8:5: warning: ignoring return value of ‘fgets’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |     fgets(s, 101, stdin);
      |     ^~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>

int main(void)
{
    char s[101];
    int i = 0;
    
    fgets(s, 101, stdin);
    
    while(s[i] != '\0'){
        if((s[i] >= 'a') && (s[i] <= 'z')){
            s[i] = toupper(s[i]);
         }else{
            s[i] = tolower(s[i]);
         }
         i++;
    }
    
    printf("%s", s);
    
    return 0;
}
0