#include <stdio.h> int main(void) { int n[10]; int c=10; long sum=0L; float av=0.0f; int i; printf("shuru 10ge "); for(i=0;i<c;i++) { printf("%2d>>>>",i+1); scanf("%d",&n[i]); sum+=n[i]; } av=(float)sum/c; for (i=0;i<c;i++) { printf(" Grade Number %d was %d",i+1,n[i]); } printf(" 平均值%f ",av); system("pause"); return 0; }
#include <stdio.h> int main(void) { long a=1L; long b=2L; long c=3L; double d=4.0; double e=5.0; double f=6.0; printf("A variable of type long occupies %d bytes.",sizeof(long)); printf(" Here addresses"); printf(" a>>>%p b>>>%p c>>>%p",&a,&b,&c); printf(" A variable of type double occupies %d bytes.",sizeof(double)); printf(" Here addresses"); printf(" d>>>%p e>>>%p f>>>%p",&d,&e,&f); system("pause"); return 0; }
#include <stdio.h> int main(void) { int i; int data[5]; for (i=0;i<5;i++); { data[i]=12*(i+1); printf(" data[%d]") } system("pause"); return 0; }