#include <stdio.h>
int main()
{
int i,j,m,p1,p2;
int a[32];
printf("Please input M :");
scanf("%d,%d,%d,&m,&p1,&p2");
for(i = 31;i > 0;i--)
{
if(m & 1 == 1)
{
a[i] = 1;
}
else
{
a[i] = 0;
}
m = m >> 1;
}
for(i = 0;i<32;i++)
printf ("%d",a[i]);
printf ("\n");
for (i = p1;i<p2;i++)
{
printf ("%d",a[i]);
}
printf ("\n");
return 0;
}
把一个三位数整数,逆序输出
include <stdio.h>
int main()
{
int a,b,c;
int m,n;
int q;
scanf("%d",&a);
b = a/100 ;
m = a%100;
c = m/10 ;
n = m%10 ;
q = 100 * n + 10 * c + b;
printf("%d\n",q);
return 0;
}