c语言(7.15)
整数反转和平方根
整数反转
#include <stdio.h>
int main()
{
int num1;
scanf_s("%d", &num1);
int rev = 0;
while(num1!=0)
{
int temp = num1 % 10;
num1 = num1 / 10;
rev = rev * 10 + temp;
}
printf("%d", rev);
return 0;
}
平方根
#include <stdio.h>
int main()
{
int num;
scanf_s("%d", &num);
int n=0;
while(num>=n*n)
{
n++;
}
printf("%d", n);
return 0;
}
原文地址:https://blog.csdn.net/fhgfyrsg/article/details/140438183
免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!