This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class test { | |
public static void main(String[] args) { | |
int x = 2; | |
int z = 0; | |
z = ++x + ++x + ++x; | |
System.out.printf("z = %d\n",z); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*-------------------------------------------------------------------- | |
| TITLE: Calculate age | |
+-------------------------------------------------------------------- | |
| AUTHOR: Nik Mohamad Aizuddin b. Nik Azmi | |
| EMAIL: [email protected] | |
| DATE CREATED: 12/NOV/2014 | |
| PURPOSE: My answer for the subject Programming Technique | |
| 2014/2015 Semester 1 Labsheet 4. | |
+-------------------------------------------------------------------- | |
| LANGUAGE: C |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% Lehmer's algorithm | |
function [] = random() | |
m = 13; % modulus value | |
x = 0:0:m-1; % will store a sequence of random number | |
a = 7; % multiplier | |
i = 0; % general-purpose counter | |
c = 0; % non-negative integer | |
p = 1; % full-period multiplier counter | |
temp = 0; % temporary variable |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*------------------------------------------------------------------+ | |
| | | |
| This program will draw a 3D cylinder using OpenGL 2.1 API | | |
| | | |
| Language: C89 strict | | |
| Compiler: GNU GCC 4.8.3 | | |
| | | |
| Tested on Fedora 19 64-bit and Windows 7 64-bit, | | |
| both works with no errors and no warnings :) | | |
| | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ========================================================== | |
# This script requires user to input the weight | |
# of the lettuce. The output of the script | |
# will display the total amount of price base | |
# on the weight (Assume that 1kg is RM2.50). | |
# | |
# Sample output will be: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
# ========================================================== | |
# This script requires user to input the weight | |
# of the lettuce. The output of the script | |
# will display the total amount of price base | |
# on the weight (Assume that 1kg is RM2.50). | |
# | |
# Sample output will be: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# ========================================================== | |
# This script requires user to input the weight | |
# of the lettuce. The output of the script | |
# will display the total amount of price base | |
# on the weight (Assume that 1kg is RM2.50). | |
# | |
# Sample output will be: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# ========================================================== | |
# This script requires user to input the name and last | |
# semester GPA. The output of the script will display your | |
# current CGPA (Assume that your current CGPA for 2 semester | |
# is 3.5). | |
# | |
# Sample output will be: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/ruby | |
# ========================================================== | |
# This script requires user to input the name and last | |
# semester GPA. The output of the script will display your | |
# current CGPA (Assume that your current CGPA for 2 semester | |
# is 3.5). | |
# | |
# Sample output will be: | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/perl | |
# ========================================================== | |
# This script requires user to input the name and last | |
# semester GPA. The output of the script will display your | |
# current CGPA (Assume that your current CGPA for 2 semester | |
# is 3.5). | |
# | |
# Sample output will be: | |
# |