第三次上机作业

来源:互联网 发布:java split . 编辑:程序博客网 时间:2024/05/01 12:25

任务一:

运行结果:(1):2 (2):4

任务二:

运行结果:(1):0 (2):1 (3):1

任务三:

运行结果:(1):53 (2):36 (3):1362

 

任务五:

 

//************************//code by 陈程 2013-4-15//************************#include <stdio.h>double dmax (double x, double y,double z)    {       if (x > y)             if (x>z)              return x;          else               return z;    else           if (y>z)           return y;        else            return z;   }         int main()    {     double a,b,c;      printf("Input 3 number:\n");      scanf_s("%lf %lf %lf",&a,&b,&c);      printf("The max is:%f \n",dmax(a,b,c));    }    


 

任务六:

//************************//code by 陈程 2013-4-15//************************#include <stdio.h>int main ()  {      int a ;  a=1;  while (a<=10)  {printf ("%d\n",a);  a++;  }   }  


 

任务七:

//************************//code by 陈程 2013-4-15//************************#include <stdio.h>int main ()  {      int a ;  a=-10;  while (a<=10)  {printf ("%d\n",a);  a++;  }   }