السلام عليكم
هذا مجموعة برامج ويطلب استخراج الايرور (الاخطاء
انا سأقول حلي فياليت اذا كان فيه خطأ اخر ولم استخرجه تبلغونني
a) int x = 1, total ;
while ( x <= 10 )
{
total += x;
++ x;
}
هنا الخطأ انه لم يضع
total=0
logic error
B) while ( y > 0 )
{
cout << y << endl;
++ y;
}
هنا لاادري مالخطأ الا ان يكون الاقواس
"Y" syntex error
c) For ( x = 100 , x >= 1 , x++ )
cout<< x << endl;
لم اعرف الخطأ؟؟
d) The following code should print whether integer value is odd or even:
switch ( value % 2 )
{
case 0:
cout << “ Even integer “ << endl;
case 1:
cout << “ Odd integer “ << endl;
}
هنا ايضا لم اعرف مالخطأ
e) The following code should output the even integers from 2 to 100
counter = 2 ;
do
{
cout << counter << endl;
counter += 2;
} While ( counter < 100 );
هنا لاياتي بعد while الفاصلة
logic error
Please.. check for my answer ....
