You are on page 1of 2

Introduction to Computing (ITC M6)

Lab 07 –
Graded Task
Datatypes, variables, input / output (cin / cout), if, if – else, if – elseif
Topic
Objective Making students familiarize with the concepts of how to write basic programs with
& proper syntax and semantics, Datatypes in C++, variable declaration and initialization,
Outcome basic input and output of variables and on top of that make students familiar with
s selection / conditional statements and understand the flow of program.

Instructions:
 Indent your code.
 Comment your code.
 Use meaningful variable names.
 Plan your code carefully on a piece of paper before you implement it.
 Name of the program should be same as the task name. i.e. the first program should
be Reg#.cpp
 You are not allowed to use any built-in functions
 You are required to follow the naming conventions as follow:
 Variables: firstName; (no underscores allowed)
Task:
Write a program that asks the user to enter a number of seconds. There are 60
seconds in a minute.
 If the number of seconds entered by the user is greater than or equal to 60,
the program should display the number of minutes in that many seconds.
 There are 3,600 seconds in an hour. If the number of seconds entered by
the user is greater than or equal to 3,600, the program should display the
number of hours in that many seconds.
 There are 86,400 seconds in a day. If the number of seconds entered by
the use is greater or equal to 86,400, the program should display the
number of days in that many seconds.
 There are 2592000 seconds in a month. If the number of seconds entered
by the use is greater or equal to 2592000, the program should display the
number of days in that many seconds.
 There are 31104000 seconds in a year. If the number of seconds entered
by the use is greater or equal to 31104000, the program should display the
number of days in that many seconds.

Note: Carefully read the question and make a proper solution for this.

Sample input: 20000000000


Sample output:

Sample input: 1876579


Sample output:

Sample input: 1100


Sample output:

Sample input: 36
Sample output:

You might also like