advertisements
مسودة الدرس :
Lesson : Tables ( static ) declaration : TYPE VAR[SIZE] Examples : int tab[10] ; float tab[200]; char names[]; store data : use For or while manually : char tab[10]={'c','h','t'...}
: كيفية ملء الجدول
#include "stdio.h" #include "stdlib.h" main () { //char tab[]={'a','b','c'}; int tab[]={3,2,6}; printf("tab[] : %d\n",tab[5]); system("pause"); }
تمرين :
#include "stdio.h" #include "stdlib.h" main () { float som=0; int size; float student[size]; int i; printf("Please enter size of table : "); scanf("%d",&size); for(i=0 ; i < size ; i++) { printf("enter mark of student[%d]:",i+1); scanf("%f",&student[i]); // save data in student[0]; i++ >> student[1];.. } for(i=0 ; i < size ; i++) { printf("\n mark of student[%d]:%g\n",i+1,student[i]); som=som+student[i]; /* som=student[0]=som; som=student[0]+student[1]; som=som+student[2]: */ } printf("\nsom : %g\n",som ); printf("\nmoyen : %g\n",som/size); system("pause"); }
فديو الشرح :
في أمان الله
0 commentaires :
Publier un commentaire