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/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/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/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
| /*------------------------------------------------------------------+ | |
| | | | |
| | 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
| % 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
| /*-------------------------------------------------------------------- | |
| | TITLE: Calculate age | |
| +-------------------------------------------------------------------- | |
| | AUTHOR: Nik Mohamad Aizuddin b. Nik Azmi | |
| | EMAIL: nickaizuddin93@gmail.com | |
| | 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
| 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
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main(void) | |
| { | |
| int x = 2; | |
| int z = 0; | |
| z = ++x + ++x + ++x; |
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
| How the GNU GCC compiler calculate the equation: | |
| x + ++y - x * ++x - --y | |
| The algorithm used when perform this computation may be different across | |
| compilers. This program is compiled using compiler GNU GCC 4.8.3 built for | |
| Red Hat 4.8.3-7. Tools that are used to reverse engineer or disassemble | |
| this program are "objdump" and "GNU GDB debugger". | |
| The program will solve the following problem: | |
| x + ++y - x * ++x - --y |