C語言基礎練習5

2021-08-09 15:01:38 字數 583 閱讀 4211

1.求乙個3x3整型矩陣對角線元素之和

#includeint main()

,, };

int i, j, sum = 0;

for (i = 0; i<3; i++)

}} printf("%d\n", sum);

return 0;

}

2.有一篇文章,共有3行文字,每行有80個字元。分別統計出大寫字母、小寫字母、數字、空格以及其他字元的個數

#include#includeint main()

} printf("capitalletter=%d\nlowerletter=%d\nspace=%d\nnumber=%d\nother=%d\n", capitalletter, lowerletter,space, number, other);

return 0;

}

3.編一程式,將兩個字串連線起來,不用strcat函式

#include#includeint main()

C語言 練習5

1.完成猜數字遊戲。define crt secure no warnings include include include include include intmenu void game else if num to guess else intmain else if choice 0 e...

C語言基礎練習

1 判斷年份是否是閏年 include int main else 如果輸入的年份能整除4但不能整除100或者能整除400就是閏年 return 0 2 判斷是否是素數 include int main printf n return0 int prime int n return 1 判斷素數函式...

C語言基礎練習

1.在螢幕上輸出以下圖案 水仙花數 是指乙個三位數,其各位數字的立方和確好等於該數本身,如 153 1 5 3?則153是乙個 水仙花數 在數論中,水仙花數 narcissistic number 也稱為自戀數 自冪數 阿姆斯壯數或阿姆斯特朗數 armstrong number 是指一n位數,其各個...