#Include Void
#Include Void
return 0;
}
Output
Your grade is D
You passed
Press any key to continue . . .
Your grade is W
False grade
Insert your grade again
Press any key to continue . . .
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 2
Purpose: SWITCH Statement
**************************************************/
#include <stdio.h>
void main()
{
int code;
printf("Enter the subject's code: ");
scanf("%d", &code);
switch (code)
{
case 1:
printf("\tTITAS\n");
break;
case 2:
case 3:
printf("\tGeotech\n");
break;
printf("\tProgramming\n");
break;
default:
printf("\nInvalid code\n");
}
}
Output
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 3
Purpose: WHILE Statement
**************************************************/
#include <stdio.h>
void main()
{
int value = 8;
while (value < 14)
{
printf("\tWhat's up guys!!!\n\n");
value++;
}
}
Output
What's up guys!!!
What's up guys!!!
What's up guys!!!
What's up guys!!!
What's up guys!!!
What's up guys!!!
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 4
Purpose: WHILE Statement
**************************************************/
#include <stdio.h>
void main()
{
int num = 1;
while (num < 3)
{
printf("\tRemember, life is not a bed of roses~~\n\n");
num++;
}
}
Output
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 5
Purpose: WHILE Statement
**************************************************/
#include <stdio.h>
void main()
{
int x = 7;
while (x < 12)
{
printf("\tThe value of x : %d\n", x);
x++;
}
}
Output
The value of x : 7
The value of x : 8
The value of x : 9
The value of x : 10
The value of x : 11
Press any key to continue . . .
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 6
Purpose: FOR Statement
**************************************************/
#include <stdio.h>
void main()
{
int x;
for (x = 0; x < 125; x = x + 25)
{
}
}
return 0;
Output
The value of x is 0
The value of x is 25
The value of x is 50
The value of x is 75
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 7
Purpose: FOR Statement
**************************************************/
#include <stdio.h>
void main()
{
int x;
for (x = 4; x < 21; x=x+4)
{
/* When x equals 21 the loop breaks. */
printf("%d\n", x);
}
}
Output
4
8
12
16
20
Press any key to continue . . .
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 8
Purpose: FOR Statement
**************************************************/
#include <stdio.h>
void main()
{
int x;
Output
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 9
Purpose: DO...WHILE Statement
**************************************************/
#include <stdio.h>
void main()
{
int a = 45;
do {
Output
The value of a: 45
The value of a: 50
The value of a: 55
The value of a: 60
The value of a: 65
Press any key to continue . . .
/**************************************************
Name: MOHD ZARIF NASHRIQ BIN MOHD NOR
ID: CE095863
Program: Program 10
Purpose: DO...WHILE Statement
**************************************************/
#include <stdio.h>
void main()
{
int x;
x = 5;
do
{
while (x != 5);
}
Output
Hello world!
I "love" PROGRAMMING