Basics

C Language

# Hello World in C

#include <stdio.h>
main() {
    printf("Hello World\n");
}

# Compile this code
gcc main.c -o myprogram

Data Types & Variables

# Data types

int:      2, 5, 100
float:      1.5, 21.6, 100.5
char:        "s", "2", "$"

# Variables

int    i, j, k;
char   c, ch;
float  salary;

# Example

#include <stdio.h>
main() {
    int num1, num2;
    int result;

    num1 = 8;
    num2 = 4;

    result = num1 + num2;
    printf("The result is: %d \n", result);

    result = num1 - num2;
    printf("The result is: %d \n", result);

    result = num1 * num2;
    printf("The result is: %d \n", result);

    result = num1 / num2;
    printf("The result is: %d \n", result);
}

IF Condition

Loops

Simple Program

Write code to check if the student grade is greater than or equal 80% then print "you are special" 3 times.

Python Language

Basic Syntax

IF Condition

Loops

Simple Program

Write code to check if the student grade is greater than or equal 80% then print "you are special" 3 times.

Lists

Simple Login Program

HTML

HTML is used to define the layout and structure of the web pages.

Forms

PHP Language

  • To run php code you will need a web server.

  • Web server is a software listens on TCP port 80 (HTTP), and its responsible to receive HTTP requests and send HTTP responses, you can think of the web server as the compiler of the language.

  • Most common web servers apache, nginx, miscrosoft IIS.

Basic Syntax

IF Conditions

Loops

Arrays

Simple Login Program (HTML)

Simple Login Program (PHP)

Last updated