Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

History of Social Media

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 64

PRESENTATION

DEPARTMENT OF CSE

Course Title: Structured Programming Language


Course Code: 0613-1107
Batch – CSE’23
Group Members:
1. Maliha Mahabub , ID- 02 Course Teacher :
2. Pricilla Sarkar , ID- 04 A.H.M Saiful Islam
3. Ismam Hossain Jihan , ID- 16 Professor
4. Salehuddin Nafi , ID- 22 Department of CSE
WHAT IS PROGRAMMING
LANGUAGE ?
TOPICS
1. Basic Information
2. Flow Chart
3. Data Types- (int, char, float, double)
4. Using “%” of a math
5. Operators ( relation operator, logical operator, increment and decrement operator, conditional
operator, bitwise operator, prefix and post fix)
6. If else and else if ladder, if else statement
7. Switch Operator (case, choice)
8. For loop, while loop, do while loop
9. Array
10. Continue statement, Break statement
11. Function
12. Parameter
13. Pointer
14. Structure
15. flies
Basic Information
Code Output
Summation
#include<stdio.h>
main()
{
int first_digit,second_last_digit,n,sum;
printf("Enter the 5-digit number\n\n");
scanf("%d",& n);

first_digit=n/10000;
second_last_digit=n%100/10;

sum=first_digit+second_last_digit;
printf("sum of the first and second last digit=%d\n",sum);
}
Input

Output
If Statement
CODE
#include<stdio.h>
main()
{
int x,y;
printf("Enter the number of X\n\n");
scanf("%d",& x);

printf("Enter the number of Y\n\n");


scanf("%d",&y);
if(x>0){printf("POSITIVE NUMBER=%d\n",x);}
if(y>0){printf("POSITIVE NUMBER=%d\n",x);}
}
Input

Output
If Else Statement
#include<stdio.h>
main()
{
int x;
printf("Enter any number \n\n");
scanf("%d",&x);

if(x%2==0){
printf("%d is EVEN NUMBER\n",x);}
else
{printf("%d is ODD NUMBER",x);}

}
Input

Output
If-Else-If Ladder
#include<stdio.h>
main()
{
int number;
printf("Enter any number \n\n");
scanf("%d",&number);

if(number>=0){
printf("The number is positive\n",number);}
else if(number<=0){
printf("The number is negative",number);}
else if(number==0) {
printf("The number is zero",number);
}
Input

Output
For Loop
Components

A.Initialization
B.Condition
C.Body
D.Update
Example

Code: Output:
#include<stdio.h>
main()
{
int i,num;
for(i=100;i<=104;i++)
{
printf("CSE'23\n");
}
}
Nested For loops
#include<stdio.h>
main()
{
int i,j;
for(i=1;i<=5;i++){
for(j=1;j<=10;j++) {
printf("%4d",i*j);
} printf("\n");
}
}
While loop
Code:
Formulae:
Initialization;
While (condition)
{ body
update
}
Output:
Do While loop
Formulae: Code:
Initialization;
Do
{ body
update
}
While (condition);
Output:
Structure
Code:
#include<stdio.h> scanf("%s %d %s %d %f",
struct personal person.name,
{ &person.day,
char name[20]; person.month,
int day; &person.year,
char month[1]; &person.salary);
int year;
printf("%s %d %s %d %.2f\n",
float salary;
person.name,
};
person.day,
main()
person.month,
{
person.year,
struct personal person;
person.salary);
printf("Input Values\n"); }
Input:

Output:
Topic Highlights
DATA TYPES
MODULO DIVISION
OPERATORS
Data types-(int, char, float & double)
Each variable in C has an associated data type. It specifies the type of data that
the variable can store like integer, character, floating, double, etc.
Here some example:

Data Type Size in bytes


char %c 1
int %d 4
float %f 4
double %If 8
Integer Data Type

The integer datatype in C is


used to store the integer
numbers (any number
including positive, negative
and zero without decimal
part). Octal values,
hexadecimal values, and
decimal values can be stored
in int data type in C.
Character Data Type

Character data type allows its


variable to store only a single
character. The size of the character
is 1 byte. It is the most basic data
type in C. It stores a single character
and requires a single byte of
memory in almost all compilers.
Float Data Type

In C programming float type data is used to


store floating-point values. Float in C is used to
store decimal and exponential values. It is used
to store decimal numbers (numbers with
floating point values) with single precision.
Double Data Type

A double data type in C is used to


store decimal numbers (numbers
with floating point values) with
double precision. It is used to
define numeric values which hold
numbers with decimal values in
C.
Modulo division

Given number of
days, convert it in
terms of Years,
Months and Days.
Operators
 Relation Operator
 Logical Operator
 Increment and Decrement Operators
 Conditional Operator
 Bitwise Operator
Relational Operators
Relational operators are the symbols that are
used for comparison between two values to
understand the type of relationship a pair of
numbers shares. The result that we get after the
relational operation is a boolean value, that tells
whether the comparison is true or false.
Relational operators are mainly used in
conditional statements and loops to check the
conditions in C programming.
Logical Operator

Logical operators used to combine multiple


conditions. Logical Operators returns either 0
or 1, it depends on whether the expression
result is true or false. In C programming for
decision-making, we use logical operators.
Increment Operators

The increment operator ( ++ ) is used to


increment the value of a variable in an
expression by 1. It can be used on variables of
the numeric type such as integer, float,
character, pointers, etc.
Decrement Operators

The decrement operator is used to


decrement the value of a variable in an
expression. In the Pre-Decrement, the value is
first decremented and then used inside the
expression. Whereas in the Post-Decrement,
the value is first used inside the expression
and then decremented.
Conditional Operator

The conditional operator is kind of similar to the


if-else statement as it follows the same algorithm as
of if-else statement but the conditional operator
takes less space and helps to write the if-else
statements in the shortest way possible.
Bitwise Operators

The following 6
operators are bitwise
operators (also known
as bit operators as they
work at the bit-level).
They are used to
perform bitwise
operations in C.
Today's
Outline

Topic Highlights
ARRAY
CONTINUE & BREAK
STATEMENT
PARAMETER
POINTER
ARRAY
Array are used to store multiple values
in a single variable , instead of
declaring separate variables for each
value.
Example :

Output :

Code :
Continue Statement
The continue statement skips the current
iteration of the loop and continue with the
next iteration.

Break Statement
The break statement ends the loop
immediately when it is encountered.

Continue &
Break
Statement
Code:

Sample

Output :
Code:

Sample

Output :
In C , There are two
types of parameter.

Parameter 1. Formal Parameter.


2. Actual Parameter.
The parameter is referred to
as variable that are defined
during a function
Actual parameter is
declaration or definition.
known as Argument.
Code:

Output:

Your text here


POINTER

A pointer is a variable that stores the


memory address of another variable as its
value.
Example:
Int a;
Int *p; => Pointer
declaration
P=&a; => Address of a
p= *p + 2 ; => Value at
Code :

Output :

Switch
operator
A control fl o w statement in
C programming.

Used to execute different


blocks of code based on
the value of an
expression.


For Equal
Number

For Less than
Number

For Greater
Number
Readability: Makes code cleaner and ⥫
easier to understand, especially with
Efficiency: Can be more efficient than
multiple conditions.
using multiple if-else statements,
especially with many cases.
Maintainability: Easy to add or
modify cases without changing the
entire structure of the code.
Passing an Entire
Array to a ⥫
Function
A feature in C programming that
allows you to pass an entire array
to a function.
Enables functions to operate on
arrays without needing to know
their size or contents beforehand.


Flexibility: Allows functions to


work with arrays of different sizes.
Modularity: Encourages code reuse
and simplifies program structure.
Readability: Makes the function
declaration and usage clearer and
more concise.

Flowchar
t
Creating a flowchart in C
programming can be a helpful way
to visualize logic of
program before actually
the your coding
it.


File
+A File is a collection of data stored on a
s
storage device. Files can be of various types,
such as text files, binary files, and more. In
C, you can work with fi l e s using functions
from the header, like fopen, fclose, fprintf,
fscanf, fread, and fwrite.
+These functions allow you to open, close,
read from, and write to files.


In CMD
Outputs ⥫

Outputs

You might also like