結果

問題 No.163 cAPSlOCK
ユーザー くれちー
提出日時 2016-08-06 00:59:55
言語 C90
(gcc 12.3.0)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 300 bytes
コンパイル時間 131 ms
コンパイル使用メモリ 20,736 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-07 00:42:11
合計ジャッジ時間 956 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.c: In function ‘main’:
main.c:8:9: warning: ignoring return value of ‘scanf’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
    8 |         scanf("%s", s);
      |         ^~~~~~~~~~~~~~

ソースコード

diff #

#include <stdio.h>
#include <string.h>

int main() {
	char s[101];
	int i;
	
	scanf("%s", s);

	for (i = 0; i < strlen(s); i++) {
		if ('a' <= s[i] && s[i] <= 'z') {
			s[i] -= ('a' - 'A');
		}
		else if ('A' <= s[i] && s[i] <= 'Z') {
			s[i] += ('a' - 'A');
		}
	}

	printf("%s\n", s);

	return 0;
}
0