Skip to content

xxSTORYxx/lab1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

lab1

Describe:

A C++ program that can read in an integer and then print out the corresponding sequence of numbers.

How does it compile:

Part A:

https://github.com/xxSTORYxx/lab1/blob/master/lab1.script

Part B:

https://github.com/xxSTORYxx/lab1/blob/master/running.script

How does it work:

When entering a number,the program will distinguish whether the nuber is odd or even.

If the number is odd,the program will reset the number as '3 multiply the number then plus 1',else,it will be divided by 2.

After that,the program will again check the value of the number and repeat those steps until the number reaches 1.

Example:

When entering a number 22,we can get a sequence:22 11 34 17 52 26 13 40 20 10 5 16 8 4 2 1.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages