الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

Arrays

بدأه goalsadi في 14 مارس 2008 · 3 رد · 858 مشاهدة · في JavaSE
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

اخواني الاعزاء

انا مبتدىء بالبرمجه بالجافا

احاول كتابة برناج يقوم بجمع مصفوفه ومن ثم ضرب المجموع بمصفوفه ثانيه

ارجو المساعده

import javax.swing.*;

public class sumarray {

// main method begins execution of Java application

public static void main( String args[] )

{

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

int b[] = { 5,4,3,2,1};

int total = 0;

int multi = 0;

// add each element's value to total

for ( int i = 0; i < a.length; i++ )

total += a[ i ];

for ( int j= 0 ; j < b.length; j++ )

multi = total * b[j]

JOptionPane.showMessageDialog( null,

"Total of array elements: " + total,multi ,

"Sum the Elements of an Array",

JOptionPane.INFORMATION_MESSAGE );

System.exit( 0 );

}

}

#2
// add each element's value to total

for ( int i = 0; i < a.length; i++ )

total += a[ i ];

multi = total;
for ( int j= 0; j < b.length; j++ )

multi = multi * b[j];
#3

شكرا يا جماعه

وإن شاء الله تسلمو

#4

حسب ما اعتقد انو الحل لازم يكون بدلا من

multi = total * b[j];

لازم يكون

b[j]= total * b[j];

mofeedchaar@hotmail.com

مواضيع مشابهة