Skip to content

Srishti44-g/HackerRank---30-Days-of-Code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

30 Days of Code --HackerRank

Day 0 : Hello World

Task : To complete this challenge, you must save a line of input from stdin to a variable, print Hello, World. on a single line, and finally print the value of your variable on a second line.

Day 1 : DataTypes

Task : Complete the code in the editor below. The variables , , and are already declared and initialized for you. You must: Declare variables: one of type int, one of type double, and one of type String. Read lines of input from stdin (according to the sequence given in the Input Format section below) and initialize your variables. Use the operator to perform the following operations: Print the sum of plus your int variable on a new line. Print the sum of plus your double variable to a scale of one decimal place on a new line. Concatenate with the string you read as input and print the result on a new line.

Day 2 : Operators

Task : Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax) for a meal, find and print the meal's total cost.

Day 3 : Intro to Conditional Statements

Task :Given an integer n, , perform the following conditional actions:

If n is odd, print Weird If n is even and in the inclusive range of 2 to 5 , print Not Weird If n is even and in the inclusive range of 6 to 20, print Weird If n is even and greater than 20, print Not Weird Complete the stub code provided in your editor to print whether or not is weird.

Day 4 : Class Vs Instance

Task :Task Write a Person class with an instance variable,age, and a constructor that takes an integer,initial_age , as a parameter. The constructor must assign initial_age to age after confirming the argument passed as initial_age is not negative; if a negative argument is passed as initial_age, the constructor should set age to 0 and print Age is not valid, setting age to 0.. In addition, you must write the following instance methods:

  • yearPasses() should increase the age instance variable by 1 .
  • amIOld() should perform the following conditional actions:
  • If age<13, print You are young..
  • If age >=13 and age<18 , print You are a teenager..
  • Otherwise, print You are old.. To help you learn by example and complete this challenge, much of the code is provided for you, but you'll be writing everything in the future. The code that creates each instance of your Person class is in the main method. Don't worry if you don't understand it all quite yet!

Day 5 - Loops.java

Task Given an integer,n , print its first 10 multiples. Each multiple n*i (where 1<=i>=10 ) should be printed on a new line in the form: n x i = result.

Day 6 - Let's Review

Task - Given a string, S, of length N that is indexed from 0 to N-1 , print its even-indexed and odd-indexed characters as 2 space-separated strings on a single line (see the Sample below for more detail).

Note: is considered to be an even index.

Day 7 - Arrays

Task Given an array, , of integers, print 's elements in reverse order as a single line of space-separated numbers.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published