Skip to content

Instantly share code, notes, and snippets.

View RohithKumar1368's full-sized avatar

K. Om Rohith RohithKumar1368

View GitHub Profile
@echo off
set logfile=log.txt
:main
echo 1.insert
echo 2.delete
echo 3.update
set /p opt=select an option:
if %opt%==1 GOTO insert
@RohithKumar1368
RohithKumar1368 / primes.cpp
Created October 1, 2017 14:13
program to print the first 500 prime numbers
#include<iostream>
using namespace std ;
int main() {
int prime[501] ;
int n = 3 ;
int j = 1 ;
prime[1] = 2 ;
@RohithKumar1368
RohithKumar1368 / Steps.cpp
Created September 17, 2017 03:29
program to find the number of ways we can climb n number of steps, given that we can take k maximum steps at a time. Also we cannot take a 0 number step.Solution using dynamic programming.
#include<iostream>
#include<algorithm>
#include<string>
#include<vector>
#include<cmath>
#include<time.h>
using namespace std ;
int pow(int n, int k){
@RohithKumar1368
RohithKumar1368 / gradingstudents.c
Created August 27, 2017 13:46
Grading Students
// Problem : https://www.hackerrank.com/challenges/grading/problem
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
#include <limits.h>
#include <stdbool.h>
@RohithKumar1368
RohithKumar1368 / maxminsum.c
Created August 27, 2017 13:10
MAX-MIN SUM
// problem at https://www.hackerrank.com/challenges/mini-max-sum
// Simply sort the elements and add the first 4 elements for min
// and the last 4 for the max
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <assert.h>
@RohithKumar1368
RohithKumar1368 / euler1.c
Last active August 16, 2017 14:16
Project Euler 1 : To find the sum of all multiples of 3 or 5 below n.
#include<stdio.h>
int main(){
int n ;
int sum ;
scanf("%d",&n) ;
int three = (n-1) / 3 ; // no of 3 multiples below n
int five = (n-1) / 5 ; // no of 5 multiples below n
int fifteen = (n-1) / 15 ; // no of 15 multiples below n