橘子味的心
标题:C实例 打印数组之和

C实例 打印数组之和

#include <stdio.h>



int main() {

   int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};

   int sum, loop;



   sum = 0;



   for(loop = 9; loop >= 0; loop--) {

      sum = sum + array[loop];      

   }



   printf("Sum of array is %d.", sum);   



   return 0;

}

目录

分类