সি এবং অ্যারে : Array in C

int marks[4][10] = {{80, 70, 92, 78, 58, 83, 85, 66, 99, 81}, {75, 67, 55, 100, 91, 84, 79, 61, 90, 97}, {98, 67, 75, 89, 81, 83, 80, 90, 88, 77}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};

 

 #include <stdio.h>  
 int main()  
 {  
     int marks[4][10] = {{80, 70, 92, 78, 58, 83, 85, 66, 99, 81}, {75, 67, 55, 100, 91, 84, 79, 61, 90, 97}, {98, 67, 75, 89, 81, 83, 80, 90, 88, 77}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};  
     int col;  
     for(col = 0; col < 10; col++) {  
         marks[3][col] = marks[0][col] / 4.0 + marks[1][col] / 4.0 + marks[2][col] / 2.0;  
         printf("Roll NO: %d  Total Marks: %d\n", col + 1, marks[3][col]);  
     }  
     return 0;  
 }

 

 int marks[4][10];  
 int i, j;  
 for (i = 0; i < 4; i++) {  
     for (j = 0; j < 10; j++) {  
         scanf("%d", &ara[i][j]);  
     }  
 } 

 

#include <stdio.h>  
 int main()  
 {  
     int namta[10][10];  
     int row, col;  
     for (row = 0; row < 10; row++) {  
         for(col = 0; col < 10; col++) {  
             namta[row][col] = (row + 1) * (col + 1);  
         }  
     }  
     for (row = 0; row < 10; row++) {  
         for(col = 0; col < 10; col++) {  
             printf("%d x %d = %d\n", (row + 1), (col + 1), namta[row][col]);  
         }  
         printf("\n");  
     }  
     return 0;  
 }  
#include <stdio.h>  
 int main()  
 {  
     char saarc[7][100] = {"Bangladesh", "India", "Pakistan", "Sri Lanka", "Nepal", "Bhutan", "Maldives"};  
     int row;  
     for (row = 0; row < 7; row++) {  
         printf("%s\n", saarc[row]);  
     }  
     return 0;  
 }  

 

 

#include <stdio.h>  
 #include <string.h>  
 int main()  
 {  
     char saarc[7][100] = {"Bangladesh", "India", "Pakistan", "Sri Lanka", "Nepal", "Bhutan", "Maldives"};  
     int row, col, name_length;  
     for (row = 0; row < 7; row++) {  
         name_length = strlen(saarc[row]);  
         for(col = 0; col < name_length; col++) {  
             printf("%c ", saarc[row][col]);  
         }  
         printf("\n");  
     }  
     return 0;  
 }  


#include <stdio.h>  
 #include <string.h>  
 int main()  
 {  
     char saarc[7][100] = {"Bangladesh", "India", "Pakistan", "Sri Lanka", "Nepal", "Bhutan", "Maldives"};  
     int row, col, name_length;  
     for (row = 0; row < 7; row++) {  
         name_length = strlen(saarc[row]);  
         for(col = 0; col < name_length; col++) {  
             printf("(%d, %d) = %c, ", row, col, saarc[row][col]);  
         }  
         printf("\n");  
     }  
     return 0;  
 }  
 
 #include <stdio.h>  
 #include <string.h>  
 int main()  
 {  
     int ara1[5][5] = {{1, 2, 3, 4, 5}, {10, 20, 30, 40, 50}, {100, 200, 300, 400, 500}, {1000, 2000, 3000, 4000, 5000}, {10000, 20000, 30000, 40000, 50000}};  
     int ara2[5][5];  
     int r, c;  
     printf("Content of first array (ara1): \n");  
     for (r = 0; r < 5; r++) {  
         for(c = 0; c < 5; c++) {  
             printf("%d ", ara1[r][c]);  
         }  
         printf("\n");  
     }  
     printf("\n");  
     // now start copy  
     for (r = 0; r < 5; r++) {  
         for(c = 0; c < 5; c++) {  
             ara2[c][r] = ara1[r][c];  
         }  
     }  
     printf("Content of second array (ara2): \n");  
     for (r = 0; r < 5; r++) {  
         for(c = 0; c < 5; c++) {  
             printf("%d ", ara2[r][c]);  
         }  
         printf("\n");  
     }  
     return 0;  
 }  



								

Permanent link to this article: http://bangla.sitestree.com/%e0%a6%b8%e0%a6%bf-%e0%a6%8f%e0%a6%ac%e0%a6%82-%e0%a6%85%e0%a7%8d%e0%a6%af%e0%a6%be%e0%a6%b0%e0%a7%87-array-in-c/