Documente Academic
Documente Profesional
Documente Cultură
1. (20 pts) Identify and correct the errors in each of the following statements.
c. if ( c < 7 ) ;
printf( “ C is less than 7\n );
d. if ( c => 7 )
printf (“C is equal to or greater than 7 \n” );
2. (10 pts) What is the final value of x after performing the following operations?
int x = 21;
float y = 6;
float z = 14;
y = x / z;
x = 5.5 * y;
Answer: ______________
if ( i > 5 )
if ( j < 5 )
printf(“A”);
else
printf(“B”);
else
printf(“C”);
If you input 4:
It prints:
4 3 2 1 0 2 4 6 8
Or, if you input 7:
It prints:
7 6 5 4 3 2 1 0 2 4 6 8 10 12 14
5. (20 pts) Write a C program using while loop(s) that takes in one integer parameter and
depending on this parameter it produces an output. For example:
Girilen sayıya en yakın 5’in katı bulunup; 0’a kadar 5er 5er azalan sonrada bulunan sayının
10 katına kadar 10 ar 10 ar artan dizilimi yapan fonksiyon yazılacak…
If you input 8:
It prints:
10 5 0 10 20 30 40 50 60 70 80 90 100
6. (20 pts) Write a C program that calculates and prints the sum of even integers from 22
to 300.
7. (20pts) Write a program that reads the user choice (from 1 to 10) and prints its channel
name description. The scala is as follows:
1&2: ShowTV
3: KanalD
4: TRT
5: FOX
6-10 : Digiturk
Notes: