السلام عليكم
هذه حلول اسئلة الفاينل وماهي الا اجتهاد شخصي واتمنى اذا كان في اي خطأ تصحيحه ونبدأ على بركة الله
حل الصفحة الاولى
حل الصفحة الثانية
حل الصفحة الثالثة
حل سؤال الصفحة الرابعة تقريبا نفس هذا الكود ولكن يحتاج تعديل بسيط ان تضيف شرط وخيار انه اليوزر يختار انتجر ولا كاركتر
كود:
#include <stdio.h>
main()
{
int y[50], size, i, min, j, temp=0;
printf("size> ");
scanf("%d", &size);
for(i=0; i<size; i++)
{
printf("enter value of y[%d]>>",i);
scanf("%d", &y[i]);
}
for (i=0; i<size/2; i++)
{
temp=y[size-(i+1)];
y[size-(i+1)]=y[i];
y[i]= temp;
}
for(i=0; i<size; i++)
{
printf("y[%d]=%d\n",i, y[i]);
}
return(0);
}
حل سؤال الصفحة الخامسة
كود:
#include<stdio.h>
main()
{
int pc=1500, m=750, pr=300, total_pc=0, total_m=0, total_pr=0, item=0, total=0;
double dis=0;
printf("for pc hit 1 \nfor monitor hit 2 \nfor printer hit 3\nto exit hit 0\n\n");
do
{
printf("enter the value of the item> ");
scanf("%d", &item);
switch(item)
{
case 0:
break;
case 1:
total_pc +=pc;
break;
case 2:
total_m +=m;
break;
case 3:
total_pr +=pr;
break;
default:
printf("wrong item number\n");
break;
}
}while(item!=0);
total = total_pc + total_m + total_pr;
if(total<1000)
{
dis = total-((double)total*10/100);
printf("the total befor the discount is %d the total after the discount is %.2lf",total, dis);
}
if(total>=1001 && total <= 2000)
{
dis= total-((double)total*20/100);
printf("the total befor the discount is %d the total after the discount is %.2lf",total, dis);
}
if(total>2001)
{
dis= total-((double)total*30/100);
printf("the total befor the discount is %d the total after the discount is %.2lf\n",total, dis);
}
return(0);
}