Classes/csci218/Lect/ex5InClass.c

38 lines
889 B
C

//Example 5 in Class
#include <stdio.h>
int main(void) {
char nameOfSchool[] = "CofC"; //variable declaration and assignment
int numOfStudent = 10000; //variable declaration and assignment
/*i ncrease number of student by 1000 */
numOfStudent += 1000;
//using compound operators
//printf("After one year, the numer of students in Cofc is %d\n", numOfStudentCofC);
printf("After one year, the number of students in Cofc is %d\n\n", numOfStudent);
/* declare integer x, y, z */
int x, y, z;
x = 0;
y = 2;
z = 3;
/* using compound operators */
// x = x + 6;
// y = y / 5;
// z = z * 5;
x += 6;
y /= 5;
z *= 5;
//y = x++;
//int z = ++x;
//printf("x = %d, y = %d, z = %d , nameOfAccountHolder = %s \n", x, y, z, nameOfAccountHolder);
printf("x = %d\ny = %d\nz = %d\n", x, y, z);
return 0;
}