السلام عليكم ورحمة الله وبركاته
صباح الخير حبايبي
شباب انا كتبت الكود حق نموذج الاختبار النهائي في المودل طبعا هو السؤال الاخير
الكود شغال تمام بس صراحة مو راضي يطبق الشغلة صح فيه لخبطة بسيطة جدا بس ماني عارف من وين بالضط
حتى نختصر الوقت اي واحد يجرب الكود وراح يعرف الغلط اذا كان هو فاهم السؤال حق الاختبار
هذا الكود تفضلوا
كود:
#include<stdio.h>
int main ()
{
int total, dis ,pc=1000,m=750,pr=300, t_pc=0,t_m=0,t_pr=0,i,n ;
printf(" choose item of list ");
printf(" 1- pc ");
printf(" 2- m " );
printf(" 3- pr" );
printf(" 4-finish ");
scanf("%d",&n);
while(n!=4)
{
if( n==1 )
{
t_pc+=pc ;
}
else if( n==2 )
{
t_m+=m;
}
else if ( n==3 )
{
t_pr+=pr ;
}
else
{
printf("run time");
}
printf(" other proccess ?? ");
scanf("%d",&n);
}
total=t_pc+t_m+t_pr ;
if(total<1000)
{
dis=total-((double)total*10/100);
printf(" the total before dis %d after dis is %d ",total,dis);
}
else if ( total>=1001 && total<=2000 )
{
dis=total-((double)total*20/100);
printf(" the total before dis %d after dis is %d ",total,dis);
}
else if (total>2000 )
{
dis=total-((double)total*30/100);
printf(" the total before dis %d after dis is %d ",total,dis);
}
return(0);
}
بانتظاركم حبايبي ..
دُمتم بخير