0% found this document useful (0 votes)
16 views

Lecture 2

Uploaded by

BADR ESLAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Lecture 2

Uploaded by

BADR ESLAM
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Assoc. Prof.

Mohamed Moawad Abdelsalam


Head of Computers Engineering and Control Systems dep., Director of Biomedical
Engineering Program, Faculty of Engineering, Mansoura University

E-mail: [email protected]

Lecture 2
Standard Input – Output Functions
2. Input function : Receive the inputs from the keyboard
Scanf (“ %Data_type”, & variable);
Integer %d
Float %f
Character %c
Example: read an integer number and store in a variable called “num”
scanf(“%d”, &num);
Example: read two float numbers and store them in “num1” and “num2”
scanf(“%f %f”, &num1, &num2);
Example: read three characters and store them in “let1” , “let2” and “let3”
scanf(“%c %c %c”, &let1, &let2, &let3);
Example 1: Write a program to read two integer numbers and print
their summation and average.

#include<stdio.h>
void main()
{
int num1,num2,sum;
float aver;
scanf(“%d %d”, &num1,&num2);
sum=num1+num2;
aver=(num1+num2)/2;
printf(“The summation =%d, and the average=%f”,sum,aver);
}
Types of operators

1. Arithmetic Operators
2. Increment & Decrement
3. Assignment Operators
4. Relational Operators
5. Logical Operators
6. Bitwise Operators

4
1. Arithmetic Operators

5
6
2. Increment & Decrement Operators

7
8
3. Assignment Operators

9
10
4. Relational Operators

11
12
13
5. Logical Operators
15
6. Bitwise Operators

17
18

You might also like