आपकी ऑफलाइन सहायता

BACK
49

सी प्रोग्रामिंग

149

पाइथन प्रोग्रामिंग

49

सी प्लस प्लस

99

जावा प्रोग्रामिंग

149

जावास्क्रिप्ट

49

एंगुलर जे.एस.

69

पी.एच.पी.
माय एस.क्यू.एल.

99

एस.क्यू.एल.

Free

एच.टी.एम.एल.

99

सी.एस.एस.

149

आर प्रोग्रामिंग

39

जे.एस.पी.





डाउनलोड पी.डी.एफ. ई-बुक्स
C - Addition Of Two Arrays

विवरण :

Enter 5 nos of 1st array
Enter 5 nos of 2nd array
Addition of two arrays


  • C के इस program में दो array का addition किया गया है |
  • इस program में चार for loop का इस्तेमाल किया है | पहला और दूसरा for loop array से 5-5 integer numbers user से लेने के लिए लिये है | तीसरा for loop उन दो array के addition के लिये लिया है और चौथा for loop लिये गए दो array के addtion हुए numbers को print करने के लिये लिया है |

सोर्स कोड :

#include <stdio.h>

int main(){

int arr1[5], arr2[5], arr3[5], i;

printf("Enter 5 nos of 1st array\n");

for( i=0; i<5; i++){

scanf("%d", &arr1[i]);
}

printf("Enter 5 nos of 2nd array\n");

for( i=0; i<5; i++){

scanf("%d", &arr2[i]);
}

for( i=0; i<5; i++){

arr3[i] = arr1[i] + arr2[i] ;
}

printf("Addition of two arrays\n");

for( i=0; i<5; i++){

printf("%d\n", arr3[i]) ;
}

return 0;
}

आउटपुट :

Enter 5 nos of 1st array
4
5
6
7
8
Enter 5 nos of 2nd array
4
5
6
7
8
Addition of two arrays
8
10
12
14
16
 

Warning: Trying to access array offset on value of type null in /home/u623081920/domains/hindilearn.in/public_html/programming-examples.php on line 195