Skip to content

Latest commit

 

History

History
186 lines (122 loc) · 5.77 KB

File metadata and controls

186 lines (122 loc) · 5.77 KB

30 days of programming with axionteq LLC

Why write code for 30 days?

Learning to write a computer code is as much as important as learning any skill. Coding or programming is a skill. You must practice daily to really sharpen your coding skill. Remember that an apple a day keeps you away from the doctor and a program a day keeps you from forgetting the synthax easily. Eventually you'd get used to it.

One of the many solutions to a daily program is available in the src/ directory.

You don't have to clone this repo, but create your own, solve the daily problems and gain your mastery.

day 1

Write a program to find the distance between point A and B, taken the coordinates of A and B from the user. Your code should return 5 for A(1, 5) and B(5, 8). You would need to include the cmath and iostream library or header files.

day 2

Write a program, taking a positive integer from the user, convert the integer to binary, octal and hexadecimal base. Make use of loops rather.

day 3

Give a signed, 4-bit binary number, write a program to convert it to its correspoding signed decimal number. Consider the table below for a sample input and output.

Input Output
1100 -4
0100 +4

day 4

Write a program to find the polar coordinate of a given rectangular (cartesian) coordinate.

day 5

Write a function that takes three reals as arguments and returns the max

day 6

Implement the bubble sort algorithm

day 7

Implement the peak algorithm, given an array and its size as argument

day 8

Implement the linear search algorithm, for a one dimensional array and and a two dimensional array, gien the array and its size as arguments. Make use of functions.

day 9

Implement the factorial algorithm.

day 10

Given a time elasped in seconds, convert it to hours, minutes anf seconds. In the format, HH:MM:SS

day 11

This problem was taken (copied) from C++ P ROGRAMMING : FROM PROBLEM ANALYSIS TO PROGRAM DESIGN FIFTH EDITION D.S. M ALIK CHAPTER 9 ARRAYS AND STRINGS, programming exercise 9

Write a program that uses a two-dimensional array to store the highest and lowest temperatures for each month of the year. The program should output the average high, average low, and the highest and lowest tempera- tures for the year. Your program must consist of the following functions:

  • Function getData : This function reads and stores data in the two-dimensional array.
  • Function averageHigh : This function calculates and returns the average high temperature for the year.
  • Function averageLow : This function calculates and returns the aver- age low temperature for the year.
  • Function indexHighTemp : This function returns the index of the highest high temperature in the array.
  • Function indexLowTemp : This function returns the index of the lowest low temperature in the array. (These functions must all have the appropriate parameters.)

day 12

Implement the min-max-sum algorithm given an array and its size as input.

day 13

write a program to find the inverse of a 2 by 2 matrix, taken an array of of size 4 as input where the 0th and 1th indexed elements are the first row and the 2th and 3th indexed elements are the second row.

day 14

Write a program to the find roots of a quadratic equation of the form, ax^2 + bx + c = 0, given a, b and c as input.

day 15

Write a program that calculates and prints the sum of all the natural numbers divisible by either 3 or 5, up to a given limit entered by the user.

day 16

Write a program that, given two positive integers, will calculate and print the greatest common divisor of the two.

day 17

Write a program that, given two positive integers, will calculate and print the lowest common multiple of the two.

day 18

Write a program that memics a calculator - takes 2 numerical inputs and an operator.

day 19

Implement the babylonian algorithm for finding the squareroot of a given number.

day 20

Implement the binary search algorithm given a sorted array, its size and the search item as input.

day 21

Write a function int max_of_four(int a, int b, int c, int d) which reads four arguments and returns the greatest of them.

day 22

Write a void function that takes three arguments, sums the first two and assigns its value to the third. (Think a little - address/poiters)

day 23

Write a program that prompts the user to enter the weight of a person in kilograms and outputs the equivalent weight in pounds. Output both the weights rounded to two decimal places. (Note that 1 kilogram = 2.2 pounds.) Format your output with two decimal places.

day 24

Write a function that takes as a parameter a nonnegative integer and generates the following pattern of stars. If the nonnegative integer is 4, then the pattern generated is:

****
***
**
*

day 25

Write a function that takes a positive integer, n, as argument and returns the nth fibonacci number.

day 26

Write a function to find the sum of the first , N, natural numbers.

day 27

Write a function to return the , Nth, harmonic sum. HMn = 1 + 1/2 + 1/3 + ... + 1/n, where n is the Nth natural number

day 28

Write a function that takes a positive integer, n, as argument and returns the nth fibonacci number, using Binet’s formula:

    f ( n ) = ( 1 + 5^0.5 )^n − ( 1 − 5^0.5 )^n
              ---------------------------------
                        2 ^ n * 5^0.5

day 29

Make a program which randomly chooses a number to guess and then the user will have a few chances to guess the number correctly. In each wrong attempt, the computer will give a hint that the number is greater or smaller than the one you have guessed.

day 30

Write a program that count down time in which the user can set a timer and then when the time is completed, the user will be notified that the time has ended.