Professional Documents
Culture Documents
#Include Int Main (: Common Format
#Include Int Main (: Common Format
#include<stdio.h>
Int main() {
YOUR CODE
return 0;
}
C-Language
Chapter-1…
To compile any C code, we first open terminal and then
we write c language compiler which is “gcc _space_ File
name”
Then to run any C code “./a.exe --- For windows”
“./a.out ----- For Mac/Linux”
Variables- Variable is the name of a memory location
which stores some data.
Rules-
• Variables are case sensitive.
o a and A are different….
• 1st Character is alphabet or ‘_’
• No comma/blank space.
• No other symbol than ‘_’
Constants- Values that don’t change (fixed).
Compilation-A computer program that translates C code
into machine code.
Que-Write a program to calculate area of square.
(Side given)
RESULT-
#In C code the compiler removes every number
after point if the function is not is not in
float, it doesn’t take any approx. For
example, in above code the 1.999999 was
converted into 1.
# OPERATOR PRESCEDENCE
*,/,%
+ , -
!,*,/,%,<,<=,>,>=,==,!=,&&,||,=
Que-Write a program to check if a number is
divisible by 2 or not.
CHAPTER-3
If-else
If(condition) {
//do something if true
}
Else if (condition 2) {
//do something if 1st false and 2nd is true
}
else {
//do something if false
}