プロが教える店舗&オフィスのセキュリティ対策術

c言語プログラミングでアルファベットの一覧を5,10,15,20,25文字目については大文字、それ以外は小文字で表示するプログラムを作成できる方お願いします
char x;
for(x=0;x<26;x++)
[
if(x%2==0) printf(”%c”___);
else printf(”%c”,___);
]

ここまで作ったんですけど、下線部がわかりません
あと、違っている箇所があれば教えいただける方お願いします

A 回答 (3件)

No.2修正


前:    if ((pt - ss + 1) % 5 == 0) {
後:    if (!((pt - ss + 1) % 5)) {
    • good
    • 0

#include <stdio.h>



main()
{
  char ss[] = "abcdefghijklmnopqrstuvwxyz\0";
  char *pt;

  pt = ss;
  while(*pt)
  {
    if ((pt - ss + 1) % 5 == 0) {
      printf("%c", toupper(*pt++));
    } else {
      printf("%c", *pt++);
    }
  }
  printf("\n");
}
    • good
    • 0

#include <stdio.h>



main()
{
  char ss[] = "abcdEfghiJklmnOpqrsTuvwxYz\0";
  char *pt;

  pt = ss;
  while(*pt) printf("%c", *pt++);
  printf("\n");
}
    • good
    • 0

お探しのQ&Aが見つからない時は、教えて!gooで質問しましょう!