-
peng111说:
利用scanf和printf函数输入整型变量m等于5,n等于2的值,计算除以n的商和余数,为什么
要用%d
#include
int main(){
int m,n,a,b;
scanf("m=%d n=%d",&m,&n);
a=m/n;
b=m%n;
printf("m/n=%d\nm%%n=%d\n",a,b);
return 0;
}//%d是一个格式控制符,用于指定变量的类型为整型,所以使用scanf和printf函数输入整型变量m等于5,n等于2的值,计算除以n的商和余数时,要用%d。
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login