Sequential Programming
description
Transcript of Sequential Programming
![Page 1: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/1.jpg)
Sequential Programming
By: Muhammad Zidny Nafan
![Page 2: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/2.jpg)
Introduction to Sequential Programming Executing program one by one instruction One isntruction exact one execute. No
instruction will be repeated The order of instruction will be executed by
the order in text (source code) The latest instruction is the latest algorithm
![Page 3: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/3.jpg)
Example 1 Print Hello World in screen
![Page 4: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/4.jpg)
Example 2 Count square’s area
![Page 5: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/5.jpg)
Example 3 Problem: A salesman will receive commision
from sale as big as 5% for each sale. Write the program to count salesman’s commision
The algorithm is first program will asked user to input salesman’s name, and total sale. Then program will count commision. Then print name and commision in screen.
![Page 6: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/6.jpg)
Example 3 Solving Problem: that program need 3
variablesvariable Data type
name string
sale long int
commision double
![Page 7: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/7.jpg)
Example 3 Code:
![Page 8: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/8.jpg)
Example 4 Convert time to second Problem: A runner take on run time in hour,
minute, and second. Write a program to convert run time become second. (example: run time= 1hour, 1minutes, 3second = 3663seconds)
Solving: formula: (hours*3600) + (minutes *60)+seconds
![Page 9: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/9.jpg)
Example 4 Code:
![Page 10: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/10.jpg)
Exercise 1Write program with these processes: Show “hello world” in screen Ask user to input his name And then print this message in screen:
“Nice to meet you, <name>.”
![Page 11: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/11.jpg)
Exercise 2Write a program that asks the user to
type the price without tax of one kilogram of tomatoes, the number of kilograms you want to buy, and the tax in percent units. The program must write the total price including taxes.
![Page 12: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/12.jpg)
Exercise 3 Write a program that asks the user to type 5
integers and writes the average of the 5 integers. (but use only 2 variables).
![Page 13: Sequential Programming](https://reader033.fdocuments.in/reader033/viewer/2022061617/5681619d550346895dd1519d/html5/thumbnails/13.jpg)
Exercise 4Write the program to help swalayan caseer for splitting return money by 50.000, 20.000, 10.000, 5.000, 2000, 1000, 500,and 100. Contoh:Return money : Rp. 88800Splitting
1 pieces 50.0001 pieces 20.0001 pieces 10.0001 pieces 5.0001 pieces 20001 pieces 10001 pieces 5003 pieces 100