几个简单有趣的c语言代码,求一简单C程序代码

1,求一简单C程序代码写好了,你看看吧,有要求再提#include<stdio.h>#include<conio.h>int main()char input[50];printf("请问 1+1=");for(;;)gets(input);if(strcmp(input,"2")==0)printf("重新输入 1+1=");}getch();}#include <stdio.h>void main() int a = 0; printf("计算1+1 = ?\n"); scanf("%d",&a);while (a != 2)printf("错误,重新输入\n");scanf("%d",&a);} if (a== 2)printf("正确\n");}}楼主,放在里面和放在外面意义是不同的 。假定p=0和n=0放在了外面,那么这个程序是什么意思呢?每次循环后如果符合条件p都要被赋值的[原因:p=p+n],也就是说p的值被改了 。它不再是0了 。每次循环都是如此 。而如果p=0在里面,那么每次循的开始都要把p的值改为0,这样就不会累加了 。所以在功能和意义上是有区别的 。不能说放在里面放在外面都一样 。【几个简单有趣的c语言代码,求一简单C程序代码】
2,关于几个简单的C语言编程 求助大神Known circle radius, column height, programming for circle circumference, cylinder volume, and accurate to the decimal point 2.1)程序代码;1) program code;2)从键盘上分别输入圆半径、圆柱高为 4、8,输出圆周长、圆柱体积 。2, respectively, from the keyboard input circle radius, column height of 4, 8, output circle circumference, cylinder volume.6、输入一个摄氏温度,编程求输出华氏温度,且精确到小数点 2 位 。(参6, enter a Celsius temperature, programmed to output Fahrenheit temperature, and accurate to the decimal point 2. (cf.考公式为 f=5/9*c+32,其中 c 为摄氏温度)Test formula for f=5/9*c+32, where C is the Celsius temperature1)程序代码;1) program code;2)从键盘上摄氏温度为 28℃,输出华氏温度 。2) from the keyboard, the temperature is 28 degrees Celsius, the output fahrenheit.为啥你打印的时候用的是%i的占位符 ……应该是%f 吧……

    推荐阅读