توصيف

صيغة الحلقة while:

while 
   
end
MATLAB

 


 

برنامج يطبع !Hello World مئة مرة:

%write Matlab program to print the word 'Hello World!' 100 times
counter=1;
while counter<=100
    disp('Hello World!')
    counter=counter+1;
end
MATLAB

 


 

برنامج يطبع الأعداد من 1 إلى 50:

%write Matlab program to print the number from 1 to 50
counter=1;
while counter<=50
    counter
    counter=counter+1;
end
MATLAB

 


 

برنامج لحساب جدول الضرب لعدد : 

%Write Matlab program that computes Multiplication Table for a number n and given by the user.
n=input('Enter the number\n');
counter=1;
while counter<=10
    result=counter*n;
    fprintf( ' %d', n )
     fprintf( '* %d', counter )
    fprintf(' The Result is : %d\n', result);
    counter=counter+1;
end
MATLAB

هل كان المحتوى مفيد؟

التعليقات

لاضافة سؤال أو تعليق على المشاركة يتوجب عليك تسجيل الدخول
تسجيل الدخول

محتاج مساعدة؟ تواصل مع مدرس اونلاين الان!

محتاج مساعدة باختيار المدرس الافضل؟ تواصل مع فريقنا الان لمساعدتك بتأمين افضل مدرس
ماهو التخصص الذي تبحث عنه؟
اكتب هنا...