Tutorial 2: Click To Edit Master Title Style

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 12

Click to edit Master title style

Tutorial 2
Basics of C

1
Click to edit Master title style

https://www.onlinegdb.com/
Online Compiler

2 2
Click to edit
Content TitleMaster
01 title style

• C is the most commonly used programming language in industry. (operating


systems, games, robot control software)

• C is the language of choice for programming embedded and mechatronic systems


with hardware interfaces.
For example, automobiles, medical equipment, traffic light control, etc.

• C is the base for almost all popular programming languages: C++, Java, C#,
Python, etc… Once you have learned C, you can pick up any other languages
by yourself.

3 3
Click charts
Flow to edit symbols
Master title
to Cstyle
code

OUTPUT
printf(...);

INPUT
scanf(...);

Area = L * W
Area=L*W;
4 4
Click to edit
General Structure
Masteroftitle
a C style
program

#include
"stdio.h" • #include is a command to the C compiler
to include a library needed by the program
• stdio: C library for input/output.
void main() • Must be included in ALL your programs
{ • The program must contain a function called
. “main” from which execution starts.
• The statements of the program are included
. between braces “{ }”
.
}

5 5
Click to edit
Content TitleMaster
03 title style

#include "stdio.h" • C is case sensitive, key words and C defined


identifiers must be written exactly as they are
given.
void main(){ • Any statement in the program ends
with a ;
printf("Welcome to • Any text string constant in your program
CSE011\n"); printf("Have must be enclosed between two double
fun!!\n"); quotes " "
• The character sequence \n makes
} the printer start a new line

6 6
Click to
Hello Program
edit Master title style
#include "stdio.h"

void main()
{
printf("Hello in England\n");
printf("Ciao in Italy\n");
printf("Hallo in Denmark\n");
printf("Bonjour in France\n");
printf("Hola in Spain\n");
printf("Merhaba in Turkey\n");
}

7 7
Click to edit
Content TitleMaster
03 title style

This program has


Include stdio.h" syntax errors

Void main(
[
Printf('Hello in England\Z’);
printf("Ciao in Italy\n")
printf("Hallo in Denmark\n";
printf("Bonjour in France\n);
printf("Hola in Spain\n");
print f("Merhaba in Turkey\n");
}

8 8
Click toCalculations
Making edit Master title style

#include "stdio.h"

void main()
{
int width = 100;
int height = 50;
int area;

area = width * height;

printf("Rectangle area equals %d\n", area);


}

9 9
Click toCalculations
Making edit Master title style

#include "stdio.h"

void main()
{
printf("Rectangle area equals %d\n", 100 * 50);
}

1010
Click toCalculations
Making edit Master title style

#include "stdio.h"

void main()
{
int width;
int height;
int area;

printf("Please Enter the Rectangle width:");


scanf("%d", &width);

printf("Please Enter the Rectangle height:");


scanf("%d", &height);

area = width * height;

printf("Rectangle area equals %d\n", area);


}
1111
Click to edit Master title style

Thank You

12

You might also like