CSEB113/ Lab 7: College of Engineering Principles of C Programming
CSEB113/ Lab 7: College of Engineering Principles of C Programming
COLLEGE OF ENGINEERING
PRINCIPLES OF C PROGRAMMING
Question 1
Write a complete C program to sum all 10 integer numbers enter by the user. The integer
number can be a positive or negatif number. Apply a repetition control structure technique
in your answer.
Question 2
#include <stdio.h>
int main() {
int n, rev = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0) {
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
printf("List of Numbers = %d", rev);
return 0;
}
What is output will be displayed for the above C program? Complete the following table
to trace the answer.
Question 3
#include <stdio.h>
int main ()
{
int a,sum = 0;
for (a = 0; a < 10; a++)
{
if ( a % 2 == 0 )
continue;
sum = sum + a;
}
printf("sum = %d",sum);
return 0;
}
What is output will be displayed for the above C program? Complete the following table
to trace the answer.
--End of Questions--