23-10-2010, 10:06 PM
|
#11
|
تاريخ التسجيل: Jul 2008
كلية: كلية الحاسبات وتقنية المعلومات
التخصص: IT
نوع الدراسة: عضو هيئة تدريس
المستوى: متخرج
البلد: جــــدة
الجنس: ذكر
المشاركات: 2,477
|
رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد

مستر احمد ممكن تحليلي دي البرامج بعضها ابغى اتاكد وبعضها ماعرفت لها...
2- Write a program that enter 2 integers, and display the result of each next mathematical processes (+ , - , * , \ , %) for the 2 variable’s in one printf command.
Hint : you may need convert the input to (double) to do the division.
3- Your summer surveying job requires you to study some maps that give distances in kilometers and some that use miles. You and your coworkers prefer to deal in metric measurements. Write a program that performs the necessary conversion.
Each miles equal to 1.609 kilometer.
Hint :
/* Converts distances from miles to kilometers. */
#include <stdio.h> /* printf, scanf definitions */
#define KMS_PER_MILE 1.609 /* conversion constant */
int main(void)
{
double miles, /* distance in miles */
kms; /* equivalent distance in kilometers */
/* 1. Get the number of miles from the user */
/* 2. Convert miles to kilometers */
/* 3. Display the number of kilometers */
return (0);
}
4- Write a program display the volume of cone ?
V= 1/3 µ r2 h
µ=3.14
r =radius
h =height
Hint:
5- What are the program output and show memory trace :
a- #include <stdio.h>
#include <conio.h>
void main( )
{
int x=0,y=15,z=-22,g;
z++;
g=x-- + z;
--y;
x+=y;
printf("x=%d\ny=%d\nz=%d\ng=%d",x,y,z,g);
getch();
}
Output Screen & memory:
b- #include <stdio.h>
#include <conio.h>
void main( )
{
int x;
x = 2%2+2*2-2/2;
printf("\nthe value of x= %d",x);
x = (3 * 9 *(3 + (9 * 3 / 3)));
printf("\nthe value of x=%d ",x);
getch();
}
Output Screen & memory:
6- Write a program that will read a number from user and tests if it’s modules 2 is equal zero, writes a message ?
Hint:
7- Calculate and display the area of a circle and the circumference.
Area of circle = 3.14 * r2
Circumference = 3.14 * 2 * r
hint :
where r is the radius.
8- Write a program that convert a test score into equivalent letter grade
Notes:
• The equivalent letter grade Table:
100 – 90 A
89 – 80 B
79 – 70 C
69 – 60 D
59 – 0 F
else out of rang
|
السؤال الثاني :
تم حله في الرد رقم 99 .
السؤال الثالث :
كود PHP:
/* Converts distances from miles to kilometers. */ #include <stdio.h> /* printf, scanf definitions */ #define KMS_PER_MILE 1.609 /* conversion constant */ int main(void) { double miles, /* distance in miles */ kms; /* equivalent distance in kilometers */ /* 1. Get the number of miles from the user */ printf("Please Enter The Number of miles : "); scanf("%lf",&miles); /* 2. Convert miles to kilometers */ kms = miles * KMS_PER_MILE; /* 3. Display the number of kilometers */ printf("number of kilometers = %f \n", kms); return (0); }
السؤال الرابع :
كود PHP:
#include <stdio.h> #include <math.h> #define PI 3.14 int main(void) { double r,h,v; printf("Enter radius : "); scanf("%lf",&r); printf("Enter height : "); scanf("%lf",&h); v = (1.0/3.0) * PI * pow(r,2) * h; printf("The V = %f \n", v); return (0); }
السؤال الخامس :
أطبع الأوتبوت ,, وتتبع المومري .
السؤال السادس :
كود PHP:
#include <stdio.h> #include <math.h> int main(void) { int x; printf("Enter Number : "); scanf("%d",&x); if ((x%2) == 0) { printf("Even\n"); } else { printf("Odd\n"); } return (0); }
السؤال السابع :
موجود في الشرائح حله .
السؤال الثامن :
كود PHP:
#include <stdio.h> #include <math.h> int main(void) { int grade; char gpa; printf("Enter Your Grade : "); scanf("%d",&grade); if (grade <= 100 && grade >= 90) { gpa = 'A'; } else if (grade <= 89 && grade >= 80) { gpa = 'B'; } else if (grade <= 79 && grade >= 70) { gpa = 'C'; } else if (grade <= 69 && grade >= 60) { gpa = 'D'; } else if (grade <= 59 && grade >= 0) { gpa = 'F'; } else { printf("out of range \n"); return 0; } printf("Your GPA is %c \n", gpa); return (0); }
|
|
سبحان الله وبحمد ,,, سبحان الله العظيم الحمد لله كما ينبغي لجلال وجهه وعظيم سلطانه . اللهم صل على محمد وعلى آل محمد كما صليت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد . اللهم بارك على محمد وعلى آل محمد كما باركت على إبراهيم وعلى آل إبراهيم إنك حميد مجيد.
|
|
|
|