求最大值、最小值、平均值

版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/TX_38381517154/article/details/78448847

求最大值、最小值、平均值

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int max=-1,min=99;
    int a=89,b=45,c=64,sum=0;
    if(max<a)
     max=a;
    if(max<b)
     max=b;
    if(max<c)
     max=c;
    if(min>a)
    min=a;
    if(min>b)
    min=b;
    if(min>c)
    min=c;
    sum=a+b+c;
    printf("max:%d\n",max);
    printf("min:%d\n",min);
    printf("ave:%d\n",sum/3);
    return 0;
}

这里写图片描述

展开阅读全文

求一SQL语句 最大值 最小值 平均值

01-08

表A中的数据rntime aa bb cc ddrn2007-10-6 20:00 0.74 0.51 0.08 -0.95rn2007-10-6 20:05 0.19 0.47 -0.03 -1.1rn2007-10-6 20:10 0.4 0.42 0.07 -0.93rn2007-10-6 20:15 0.37 0.44 0.07 -0.92rn2007-10-6 20:20 0.42 0.47 0.15 -0.8rn2007-10-6 20:25 0.65 0.44 0.13 -0.85rn2007-10-6 20:30 1.21 0.65 0.07 -0.97rn2007-10-6 20:35 0.98 0.49 0.26 -0.63rn2007-10-6 20:40 1.4 0.54 0.13 -0.87rn2007-10-6 20:45 1.63 0.68 0.01 -1.03rn2007-10-6 20:50 1.26 0.56 -0.01 -1.08rn2007-10-6 20:55 1.17 0.56 0.1 -0.88rn2007-10-6 21:00 0.98 0.51 0.12 -0.83rn2007-10-6 21:05 1.49 0.51 0.08 -0.95rn2007-10-6 21:10 1.68 0.47 -0.03 -1.1rn2007-10-6 21:15 1.35 0.42 0.07 -0.93rn2007-10-6 21:20 1.49 0.44 0.07 -0.92rn2007-10-6 21:25 1.21 0.44 0.13 -0.85rn2007-10-6 21:30 0.98 0.51 -0.04 -1.15rn2007-10-6 21:35 1.26 0.47 0.04 -0.97rn2007-10-6 21:40 0.14 0.54 0.14 -0.87rn2007-10-6 21:45 0.19 0.42 0.12 -0.83rn2007-10-6 21:50 0.51 0.63 0.01 -1.03rn2007-10-6 21:55 0.65 0.42 -0.11 -1.2rn2007-10-6 22:00 0.75 0.61 0.21 -0.75rn2007-10-6 22:05 0.7 0.51 0.03 -0.98rn2007-10-6 22:10 0.37 0.65 0.02 -1.03rn2007-10-6 22:15 1.17 0.33 0.11 -0.9rn2007-10-6 22:20 1.63 0.44 -0.02 -1.03rn2007-10-6 22:25 1.35 0.54 0.07 -0.97rn2007-10-6 22:30 1.72 0.65 0.22 -0.72rn2007-10-6 22:35 1.82 0.65 -0.06 -1.08rn2007-10-6 22:40 1.86 0.65 0.03 -1rn2007-10-6 22:45 1.91 0.63 0.14 -0.82rn2007-10-6 22:50 1.82 0.61 0.16 -0.83rn2007-10-6 22:55 1.82 0.58 -0.02 -1.08rn2007-10-6 23:00 1.72 0.65 -0.04 -1.12rn2007-10-6 23:05 2.05 0.49 0.21 -0.73rn2007-10-6 23:10 2.28 0.65 0.07 -0.95rn2007-10-6 23:15 1.68 0.56 -0.06 -1.1rn2007-10-6 23:20 1.63 0.7 0.28 -0.6rn2007-10-6 23:25 1.4 0.51 -0.04 -1.15rn2007-10-6 23:30 0.51 0.47 0.04 -0.97rn2007-10-6 23:35 0.37 0.54 0.14 -0.87rn2007-10-6 23:40 0.56 0.42 0.12 -0.83rn2007-10-6 23:45 0.75 0.63 0.01 -1.03rn2007-10-6 23:50 0.93 0.42 -0.11 -1.2rn2007-10-6 23:55 0.98 0.61 0.21 -0.75rn2007-10-7 0.75 0.51 0.03 -0.98rn2007-10-7 0:05 0.51 0.65 0.02 -1.03rn2007-10-7 0:10 0.56 0.33 0.11 -0.9rn2007-10-7 0:15 0.7 0.44 -0.02 -1.03rn2007-10-7 0:20 0.56 0.54 0.07 -0.97rn2007-10-7 0:25 0.56 0.65 0.22 -0.72rn2007-10-7 0:30 0.42 0.65 -0.06 -1.08rn2007-10-7 0:35 0.09 0.65 0.03 -1rn2007-10-7 0:40 0.61 0.63 0.14 -0.82rn2007-10-7 0:45 0.75 0.61 0.16 -0.83rn2007-10-7 0:50 0.42 0.58 -0.02 -1.08rn2007-10-7 0:55 0.84 0.65 -0.04 -1.12rn2007-10-7 1:00 0.47 0.49 0.21 -0.73rn2007-10-7 1:05 0.61 0.65 0.07 -0.95rn2007-10-7 1:10 0.56 0.56 -0.06 -1.1rn2007-10-7 1:15 0.51 0.7 0.28 -0.6rn2007-10-7 1:20 0.33 0.51 -0.04 -1.15rn2007-10-7 1:25 0.56 0.47 0.04 -0.97rn2007-10-7 1:30 0.7 0.54 0.14 -0.87rn2007-10-7 1:35 0.51 0.42 0.12 -0.83rn2007-10-7 1:40 0.7 0.63 0.01 -1.03rn2007-10-7 1:45 0.7 0.42 -0.11 -1.2rn2007-10-7 1:50 0.42 0.61 0.21 -0.75rn2007-10-7 1:55 0.89 0.51 0.03 -0.98rn2007-10-7 2:00 0.7 0.65 0.02 -1.03rn2007-10-7 2:05 0.89 0.33 0.11 -0.9rn2007-10-7 2:10 0.19 0.44 -0.02 -1.03rn2007-10-7 2:15 0.51 0.54 0.07 -0.97rn2007-10-7 2:20 0 0.65 0.22 -0.72rn2007-10-7 2:25 1.12 0.65 -0.06 -1.08rn2007-10-7 2:30 1.4 0.65 0.03 -1rn2007-10-7 2:35 1.17 0.63 0.14 -0.82rnrn我想要的结果为rntime aa(最大值) aa(最小值) aa(平均值) bb(最大值) bb(最小值) bb(平均值) cc(最大值) cc(最小值) cc(平均值) rn2007-10-6 20:00 12 14 13rn2007-10-6 21:00 41 12 12rn2007-10-6 22:00rn2007-10-6 23:00rn2007-10-7 00:00rn2007-10-7 1:00rn2007-10-7 2:00rnrn也就是说 把 2007-10-6 所有的20:00的数据 汇总求最大值 最小值 平均值rn2007-10-6 所有的21:00的数据 汇总求最大值 最小值 平均值rn2007-10-6 所有的22:00的数据 汇总求最大值 最小值 平均值rn2007-10-6 所有的23:00的数据 汇总求最大值 最小值 平均值rn以此类推。。rn我是个新手,感谢帮忙。。rnrnrnrn 论坛

没有更多推荐了,返回首页