Skip to content

Instantly share code, notes, and snippets.

View sysuin's full-sized avatar
:octocat:
I may be slow to respond.

Sunny Singh sysuin

:octocat:
I may be slow to respond.
  • Doeity Labs
  • GMT+5:30
View GitHub Profile
@sysuin
sysuin / hindicodingzone.ipynb
Created September 6, 2018 15:50
HindiCodingZone.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@sysuin
sysuin / Armstrong Numbers
Created December 23, 2018 14:50
For a given 3 digit number, find whether it is armstrong number or not
# https://practice.geeksforgeeks.org/problems/armstrong-numbers/0/?track=interview-mathematical
import os
import random
import re
import sys
t = int(input())
for i in range(t):
n = int(input())
@sysuin
sysuin / Add two fractions
Created December 23, 2018 16:46
You are given four numbers num1, den1, num2, and den2. You need to find (num1/den1)+(num2/den2) and output the result in the form of (numx/denx).
def addFraction(num1, den1, num2, den2):
from math import gcd
num = num1*den2+num2*den1
den = den1*den2
ka=gcd(num,den)
h=num//ka
d=den//ka
print(str(h)+"/"+str(d))
@sysuin
sysuin / Print the Kth Digit
Created December 27, 2018 17:00
Given two numbers A and B, find Kth digit from right of AB.
def kthdigit(a,b,k):
res = str(pow(a,b))
length = len(res)-k
print(res[length])
return
test = int(input())
for i in range(test):
abk = input().split()
a = int(abk[0])
@sysuin
sysuin / Day of the week
Created December 30, 2018 08:35
Write a program that calculates the day of the week for any particular date in the past or future.
test = int(input())
for i in range(test):
dmy = input().split()
d = int(dmy[0])
m = int(dmy[1])
y = int(dmy[2])
day = ["Sunday", "Monday", "Tuesday", "Wednesday",
"Thursday", "Friday", "Saturday"]
@sysuin
sysuin / IP Mathematics
Created December 30, 2018 10:11
Geeksforgeeks Test
test = int(input())
for i in range(test):
n = int(input())
if len(str(n))==1:
print(n)
else:
arr = []
for x in range(2,int(n/2)+2):
if n%x==0:
r = int(n/x)