SlideShare a Scribd company logo
1 of 18
PROBLEM SOLVING THROUGH
PROGRAMMING LAB
(18ESCS01L)
1
WEEK – 1 PRACTICE PROGRAMS
MANJUNATH
C
R
1. PROGRAM TO DISPLAY “HELLO WORLD”
2. ARITHMETIC OPERATORS
3. CALCULATE SIMPLE INTEREST
4. CALCULATE AREA OF CIRCLE, TRIANGLE,
RECTANGLE
2
MANJUNATH
C
R
PRACTICE PROGRAMS
3
MANJUNATH
C
R
PRACTICE PROGRAM 1 –
PROGRAM TO DISPLAY “HELLO WORLD”
DISPLAY “HELLO WORLD”
ALGORITHM:
STEP 1: Start
STEP 2: Input the string “Hello world”
STEP 3: Display “Hello World”
STEP 4: Stop
4
MANJUNATH
C
R
DISPLAY “HELLO WORLD”
FLOWCHART:
5
MANJUNATH
C
R
PROGRAM TO DISPLAY “HELLO WORLD”
#include<stdio.h>
#include<conio.h>
void main()
{
printf("Hello World n");
getch();
}
6
MANJUNATH
C
R
7
MANJUNATH
C
R
PRACTICE PROGRAM 2 –
ARITHMETIC OPERATORS
ARITHMETIC OPERATORS
ALGORITHM:
STEP 1: Start
STEP 2: Declare the variables a, b, sum, diff, mul, div
STEP 3: Input the values a, b
STEP 4: sum  a + b
diff  b – a
mul  a * b
div  b / a
STEP 5: Print the value of sum, diff, mul, div
STEP 6: Stop
8
MANJUNATH
C
R
ARITHMETIC OPERATORS
FLOWCHART:
9
MANJUNATH
C
R
ARITHMETIC OPERATORS
#include<stdio.h>
#include<conio.h>
void main()
{
intt a, b , sum, dif, mul, div;
printf("ENter value of A & B ");
scanf(“%d %d", &a, &b);
sum = a + b;
dif = a - b;
mul = a * b;
div = b / a;
printf("Sum = %d n", sum);
printf("Diff = %d n", dif);
printf("Mul = %d n", mul);
printf("Div = %d n", div);
getch();
}
10
MANJUNATH
C
R
11
MANJUNATH
C
R
PRACTICE PROGRAM 3 –
CALCULATE SIMPLE INTEREST
CALCULATE SIMPLE INTEREST
ALGORITHM:
STEP 1: Start
STEP 2: Declare variables p, t, r, si
STEP 3: Input the values of p, t, r
STEP 4: si  (p * t * r) / 100
STEP 5: Display value of si
Step 6: Stop
12
MANJUNATH
C
R
CALCULATE SIMPLE INTEREST
FLOWCHART:
13
MANJUNATH
C
R
CALCULATE SIMPLE INTEREST
#include<stdio.h>
#include<conio.h>
void main()
{
float p, t, r, si;
printf("Enter the value of P, T, R: ");
scanf("%f %f %f", &p, &t, &r);
si = (p * t * r)/100;
printf("Simple Interest = %f", si);
getch();
}
14
MANJUNATH
C
R
15
MANJUNATH
C
R
PRACTICE PROGRAM 4 –
CALCULATE AREA OF CIRCLE,
TRIANGLE, RECTANGLE
CALCULATE AREA OF CIRCLE, TRIANGLE, RECTANGLE
ALGORITHM:
Step 1: Start
Step 2: Declare variables r, area_cir, b, h, area_tri, l, w,
area_rec;
Step 3: Input the values r, b, h, l, w
Step 4: area_cir  3.14 * r * r
area_tri  0.5 * b * h
area_rec  l * w
Step 5: Display the values of area_cir, area_tri, area_rec
Step 6: Stop
16
MANJUNATH
C
R
FLOWCHART:
17
MANJUNATH
C
R
CALCULATE AREA OF CIRCLE, TRIANGLE, RECTANGLE
#include<stdio.h>
#include<conio.h>
void main()
{ float r, area_cir, b, h, area_tri, l, w, area_rec;
printf("Enter the value of r: ");
scanf("%f", &r);
area_cir = 3.14 * r * r;
printf("Area of Circle = %f n", area_cir);
printf("Enter the value of b and h:");
scanf("%f %f", &b, &h);
area_tri = 0.5 * b * h;
printf("Area of Triangle = %f n", area_tri);
printf("Enter the value of l and w:");
scanf("%f %f", &l, &w);
area_rec = l * w;
printf("Area of Rectangle = %f n", area_rec);
getch();
}
18
MANJUNATH
C
R
CALCULATE AREA OF CIRCLE, TRIANGLE, RECTANGLE

More Related Content

Similar to 1. PSP_Lab_Week1.pdf

Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
alish sha
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
alish sha
 
Unit 1 ocs752 introduction to c programming
Unit 1 ocs752 introduction to c programmingUnit 1 ocs752 introduction to c programming
Unit 1 ocs752 introduction to c programming
vrgokila
 
C programming Quiz t or f.pptx
C programming Quiz t or f.pptxC programming Quiz t or f.pptx
C programming Quiz t or f.pptx
AdrianVANTOPINA
 

Similar to 1. PSP_Lab_Week1.pdf (20)

Simple C programs
Simple C programsSimple C programs
Simple C programs
 
Bti1022 lab sheet 3
Bti1022 lab sheet 3Bti1022 lab sheet 3
Bti1022 lab sheet 3
 
Computer applications in civil engineering lab
Computer applications in civil engineering labComputer applications in civil engineering lab
Computer applications in civil engineering lab
 
Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7Dam31303 dti2143 lab sheet 7
Dam31303 dti2143 lab sheet 7
 
Mech nacp lab
Mech nacp labMech nacp lab
Mech nacp lab
 
C programming Lab 1
C programming Lab 1C programming Lab 1
C programming Lab 1
 
'C' language notes (a.p)
'C' language notes (a.p)'C' language notes (a.p)
'C' language notes (a.p)
 
7 functions
7  functions7  functions
7 functions
 
Plsql programs(encrypted)
Plsql programs(encrypted)Plsql programs(encrypted)
Plsql programs(encrypted)
 
C PROGRAMS
C PROGRAMSC PROGRAMS
C PROGRAMS
 
javapravticalfile.doc
javapravticalfile.docjavapravticalfile.doc
javapravticalfile.doc
 
Itp practical file_1-year
Itp practical file_1-yearItp practical file_1-year
Itp practical file_1-year
 
Unit 1 ocs752 introduction to c programming
Unit 1 ocs752 introduction to c programmingUnit 1 ocs752 introduction to c programming
Unit 1 ocs752 introduction to c programming
 
Gpus graal
Gpus graalGpus graal
Gpus graal
 
Lab 2
Lab 2Lab 2
Lab 2
 
Unit2 C
Unit2 CUnit2 C
Unit2 C
 
Unit2 C
Unit2 C Unit2 C
Unit2 C
 
C programming Quiz t or f.pptx
C programming Quiz t or f.pptxC programming Quiz t or f.pptx
C programming Quiz t or f.pptx
 
week-3x
week-3xweek-3x
week-3x
 
Muzzammilrashid
MuzzammilrashidMuzzammilrashid
Muzzammilrashid
 

Recently uploaded

21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
rahulmanepalli02
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
MaherOthman7
 

Recently uploaded (20)

Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...Developing a smart system for infant incubators using the internet of things ...
Developing a smart system for infant incubators using the internet of things ...
 
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and ToolsMaximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
Maximizing Incident Investigation Efficacy in Oil & Gas: Techniques and Tools
 
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas SachpazisSeismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
Seismic Hazard Assessment Software in Python by Prof. Dr. Costas Sachpazis
 
Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)Theory of Time 2024 (Universal Theory for Everything)
Theory of Time 2024 (Universal Theory for Everything)
 
CLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference ModalCLOUD COMPUTING SERVICES - Cloud Reference Modal
CLOUD COMPUTING SERVICES - Cloud Reference Modal
 
21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx21P35A0312 Internship eccccccReport.docx
21P35A0312 Internship eccccccReport.docx
 
Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...Fuzzy logic method-based stress detector with blood pressure and body tempera...
Fuzzy logic method-based stress detector with blood pressure and body tempera...
 
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptxSLIDESHARE PPT-DECISION MAKING METHODS.pptx
SLIDESHARE PPT-DECISION MAKING METHODS.pptx
 
Filters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility ApplicationsFilters for Electromagnetic Compatibility Applications
Filters for Electromagnetic Compatibility Applications
 
The Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptxThe Entity-Relationship Model(ER Diagram).pptx
The Entity-Relationship Model(ER Diagram).pptx
 
Working Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdfWorking Principle of Echo Sounder and Doppler Effect.pdf
Working Principle of Echo Sounder and Doppler Effect.pdf
 
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTUUNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
UNIT-2 image enhancement.pdf Image Processing Unit 2 AKTU
 
Insurance management system project report.pdf
Insurance management system project report.pdfInsurance management system project report.pdf
Insurance management system project report.pdf
 
Circuit Breakers for Engineering Students
Circuit Breakers for Engineering StudentsCircuit Breakers for Engineering Students
Circuit Breakers for Engineering Students
 
Software Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdfSoftware Engineering Practical File Front Pages.pdf
Software Engineering Practical File Front Pages.pdf
 
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...8th International Conference on Soft Computing, Mathematics and Control (SMC ...
8th International Conference on Soft Computing, Mathematics and Control (SMC ...
 
engineering chemistry power point presentation
engineering chemistry  power point presentationengineering chemistry  power point presentation
engineering chemistry power point presentation
 
Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..Maher Othman Interior Design Portfolio..
Maher Othman Interior Design Portfolio..
 
Interfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdfInterfacing Analog to Digital Data Converters ee3404.pdf
Interfacing Analog to Digital Data Converters ee3404.pdf
 
Diploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdfDiploma Engineering Drawing Qp-2024 Ece .pdf
Diploma Engineering Drawing Qp-2024 Ece .pdf
 

1. PSP_Lab_Week1.pdf