c語言取余符號是【%%u3011,其余數(shù)符號取決于被除數(shù),即被除數(shù)為正數(shù),則余數(shù)為正數(shù);被除數(shù)為負數(shù),則余數(shù)為負數(shù),語法為【被除數(shù)%%u9664數(shù)=余數(shù)】。
在c語言中,求余運算,又稱取模運算,其余數(shù)符號取決于被除數(shù),即被除數(shù)為正數(shù),則余數(shù)為正數(shù);被除數(shù)為負數(shù),則余數(shù)為負數(shù)。
求余運算語法
求余運算符:%
被除數(shù)%%u9664數(shù)=余數(shù)求余運算實例:
#include <stdio.h>int main(void){ printf("%d\\\\n", 8%5); printf("%d\\\\n", 8%-5); printf("%d\\\\n", -8%5); printf(" %d\\\\n", -8%-5); return 0;}以上程序輸出:
33-3-3相關學習推薦:c視頻教程