0% found this document useful (0 votes)
17 views2 pages

واجب

Uploaded by

[[ MøtazSâ ]]
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views2 pages

واجب

Uploaded by

[[ MøtazSâ ]]
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Course's Name: Computer Programming 1 Palestine Technical University - Kadoorie Instructor's Name: Dr.

Sherin Hijazi
Course's Number :19040112 Student's Name:
Motaz saed
…………..
alkhouli
……………………
Period: 1 week Student's Number:
2023118221…….……...………………….……….
Questions' Number: 2 Section's Number: (2 )
Assigmnt #1
Total Marks: 10
1st Semester 2023/2024 Date: 7-11 -2023 to 14-11 -2023
Pages' Number: 1

Q1:

#include <stdio.h>

int main() {

int num1, num2, num3, num4, num5, sum;

float average;

printf("Enter five integers: ");

scanf("%d %d %d %d %d", &num1, &num2, &num3, &num4, &num5);

sum = num1 + num2 + num3 + num4 + num5;

switch(sum > 500) {

case 1:

printf("Sum of the numbers is: %d\n", sum);

break;

case 0:

average = (float)sum / 5;

printf("Average of the numbers is: %.2f\n", average);

break;

return 0;
Q2:

#include <stdio.h>

int main() {

int number;

// Input an integer greater than 1000

do {

printf("Enter an integer greater than 1000: ");

scanf("%d", &number);

} while (number <= 1000);

// Extract the last digit

int lastDigit = number % 10;

// Check if the last digit is even or odd

if (lastDigit % 2 == 0) {

printf("The last digit %d is even.\n", lastDigit);

} else {

printf("The last digit %d is odd.\n", lastDigit);

return 0;

Best regards, Dr. Sherin Hijazi

Page 1 of 1

You might also like