عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
قديم 24-11-2010, 07:27 PM   #893

sil--ver

جامعي

الصورة الرمزية sil--ver

 
تاريخ التسجيل: Jul 2009
التخصص: IT ^.^
نوع الدراسة: إنتظام
المستوى: السادس
الجنس: ذكر
المشاركات: 137
افتراضي رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

المشاركة الأصلية كتبت بواسطة ® βutteяfly aηgel«~. مشاهدة المشاركة
. Write a program that print the final price of purchase at a store where everything costs exactly one dollar. ask for the number of items purchased. Compute a sales tax of:
• 8 percent if the users purchase is less than $100
• 7.5 percent if the purchase is greater or equal to $100.
• //also if the purchase is over $500, give the customer an additional 10 percent after-tax discount.
• print the purchase price, the amount of tax, the amount of the discount ($0.00 if no discount applies) and the total price.
• output:
Enter number of items purchased= 60
the purchase price= 60 $
the amount of tax= 4.8
the total price= 64.8 $



يآليت احد يجآوبلي عليه ,.
أختي السوال محلول في مشاركة
أتاكدي منه أذا كان صحيح لان السوال حليته على ما فهمته


المشاركة الأصلية كتبت بواسطة sil--ver مشاهدة المشاركة
أختي هذا الحل إذا كان صح الله يوفقك
وإذا كان خطا ألله يعينك

كود:
# include <stdio.h>
int main(){
	int a;
  double n,s;
printf("enter number of items >>");
scanf("%d",&a);
if(a<100)
{
n=(a*8)/100.0;
s=a+n;
}
else if(a>=100){
n=(a*7.5)/100.0;
s=a+n;}

else if(a>=500){

n=(a*7.5)/100.0;
s=a+n;
s=s+((s*10)\100);
}
printf("the purchase price= %d$\n",a);
printf("he amount of tax= %.2f \n",n);
printf("the total price= %.2f$\n",s);
return(0);
}

 

توقيع sil--ver  

 

بسم الله الرحمن الرحيم


رأيت العلم صاحبه كريمٌ......ولو ولدته آباءُ لئِـامُ
وليس يزال يرفعه إلى أن......يُعظم أمره القوم الكرامُ
ويتبعونه في كل حالٍ......كراعي الضأن تتبعه السوام
فلولا العلم ماسعدت رجال......ولاعُرِف الحلال ولا الحرامُ


 

sil--ver غير متواجد حالياً   رد مع اقتباس