輸入一個正整數x,若x滿足 0
感謝
2007-08-14 09:53:40 · 2 個解答 · 發問者 希兒 2 in 電腦與網際網路 ➔ 程式設計
#include
#include
int main(){
int i,x,count=0;
scanf("%d",&x);
i=x;
if (x>0&&x<32768)
while (i>0){
i/=10;
count++;
}
printf("x是%d位數 x的個位數=%d\n",count,x%10);
system("pause");
return 0;
}
//DEV-C++
2007-08-14 10:10:39 · answer #1 · answered by no nickname 2 · 0⤊ 0⤋
#include
#include
#include
int main(int argc, char* argv[]){
//=====START=====//
int num;
printf("Input a number: "),scanf("%d",&num);
if(abs(num)<0x8000){
printf("Bit is %d.\nLast bit is %d.\n",(int)(log10(num)+1),num%10);
}
//=====END=====//
system("PAUSE");
return 0;
}
2007-08-14 15:24:05 · answer #2 · answered by Big_John-tw 7 · 0⤊ 0⤋