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

Poll question-01

 Which one is the output of the program?

(a) 10
#include<stdio.h>
(b) a main()
{
(c) %d int a;
a = 10;
(d) None printf(“%d”, a)
}
Input, Output Statement

scanf() scanf(“%c”, &c) printf() printf(“%c”, c)

getch() c = getch() putch() putch(c)


Area of Variable

char 1 byte %c

int 2 byte %d

float 4 byte %f

double 8 byte %lf


char, int, float, double type data Input, Output program

#include<stdio.h>
int main()
{
char A1;
int A2;
float A3;
double A4;

scanf("%c%d%f%lf", &A1,&A2,&A3,&A4);

printf("we have %c %d %f %lf",A1,A2,A3,A4);

return 0;
}
Key Word
Special Reserved word for program

auto double int struct

break else long switch

case enum register typedef

char extern return union

const float short unsigned

continue for signed void

default goto sizeof volatile

do if static while
Poll Question-02

 Which cannot be a name of variable?

(a) 123Abc

(b) continue

(c) main

(d) All of the above


Operator
Unary Sum +
Unary Unary Subtraction - High
Operator priority
Incremental Operator ++

Decremental Operator --

Arithmatic Operator + - * / %

Relational Operator > >= < <= == !=

Logical Operator || && !


Binary
Assignment Operator =: += -= /= *= %=
Operator Low
Conditional Operator ?: priority
Bitwise Operator & | ^ << >>

Comma Operator ,
Unary Operator

int a = 10; int a = 10;


int b = +a; b= int b = a++; b=
printf(“%d”, b); printf(“%d”, b);

int a = 10; int a = 10;


int b = -a; b= int b = a--; b=
printf(“%d”, b); printf(“%d”, b);
Poll Question-03

 Which one is the output of the Program?


(a) 9, 10, 11
#include<stdio.h>
(b) 10, 11, 12 main()
{
(c) 10, 10 , 10 int a, b, c;
a = 10;
(d) 11, 12, 13 b = a++;
c = b++;
printf(“%d %d %d”, a, b, c);
}
Unary Operator

Prefix Notation Postfix Notation

#include<stdio.h> #include<stdio.h>
main() main()
{ {
int a = 10; c= int a = 10; d=
int c = ++a; int d = a++;
printf(“%d”, c); printf(“%d”, d);
} }
Poll Question-04

 Which one is the output of the program?

(a) 10, 11, 12


#include<stdio.h>
(b) 10, 10, 11 main()
{
(c) 12, 10 , 12 int a, b, c;
a = 10;
(d) 11, 12, 13 b = a++;
c = ++a;
printf(“%d %d %d”, a, b, c);
}
Program, Flowchart & Algorithm to sum two integer Number

Flow Chart C Program Algorithm

start
#include<stdio.h>
input int main()
a, b, {
int a, b, sum;
scanf("%d%d",&a,&b);
r=a+b sum = a + b;
printf("sum is %d", sum);
return 0;
print r
}

end
Program, Flowchart & Algorithm to subtract two fraction Number

Flow Chart C Program

Start

#include<stdio.h>
input
int main()
float a,b,r
{
float a, b, sub;
r=a-b scanf("%f%f",&a,&b);
sub = a - b;
printf("sub is %f", sub);
print r return 0;
}

End
Program, Flowchart & Algorithm to sum, subtract, multiply, divide two Number

Flow Chart C Program

Start
#include<stdio.h>
int main()
input float a, b {
float a, b, sum, sub, mul, div;
scanf("%f%f",&a,&b);
r=a+b sum = a + b;
s=a–b sub = a - b;
m=a*b mul = a * b;
d=a/b div = a / b;

printf("%.2f %.2f %.2f


print r,s,m,d %.2f",sum,sub,mul,div);
return 0;
}
End
Program, Flowchart & Algorithm to calculate Area of Circle from radius

Flow Chart C Program

Start
#include<stdio.h>
int main()
float r {
float r,A;
float pi = 3.1416;
scanf("%f", &r);
A = pi * r * r;
printf("%f",A);
print A return 0;
}

End
Program, Flowchart & Algorithm to calculate Area of a Triangle from its base & hight

Flowchart C Program
Start

input #include<stdio.h>
float b,h int main()
{
float b,h,A;
A = (b*h)/2 scanf("%f%f", &b,&h);
A = (b*h)/2;
printf("%f", A);
print A return 0;
}
End
Poll Question-05

 Which one is the output of the program?

(a) 5 #include<stdio.h>
#include<math.h>
(b) 10 Main()
{
(c) 15 int a, b, c, d;
a = 5, b = 2;
(d) 7 c = pow(a, b);
d = sqrt(c);
printf(“%d”, d);
}
Program, Flowchart & Algorithm to calculate Celcius value from Farenheit

Flow Chart C Program


#include<stdio.h>
Start
int main()
{
float F
float c,f;
scanf("%f", &f);
C=(F-32)*5/9 c = (f-32)*5/9;
printf("%.2f", c);
Print C }

End

You might also like