Skip to content

Instantly share code, notes, and snippets.

View sanikamal's full-sized avatar

Sani Kamal sanikamal

View GitHub Profile
@sanikamal
sanikamal / activity_main.xml
Created September 14, 2017 14:25
Example of RelativeLayout XML
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<TextView
android:text="I’m in this corner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
@sanikamal
sanikamal / SumOfN.java
Created September 15, 2017 08:49
Java program to print the sum of squares of the elements of an array of size N. N can be any integer between 1 and 100. 1≤N≤100
import java.util.Scanner;
public class SumOfN {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
int N = s.nextInt();
@sanikamal
sanikamal / NumberInRange.java
Created September 15, 2017 08:53
Java program to list all the integers between two integers L and R (including L and R). L and R can be any integer between 1 and 100. 1≤L,R≤100
import java.util.Scanner;
public class NumbersInRange {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
// Get L and R from the input
@sanikamal
sanikamal / AddTwoArrays.java
Created September 15, 2017 09:16
Java program to add the corresponding elements of two arrays, each of size N and print the sums. N can be any integer between 1 and 100. 1≤N≤100
import java.util.Scanner;
public class AddTwoArrays {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
// Reading integer from input
int N = s.nextInt();
@sanikamal
sanikamal / add_two.py
Created September 15, 2017 09:19
Python3 program to print the sum of two integers.
# Get the input for the two variables
num1, num2 = map(int, input().split())
sum_integer = 0
# logic to add these numbers here:
sum_integer=num1+num2
@sanikamal
sanikamal / add_four_int.py
Created September 15, 2017 09:22
Python program to print the sum of all the elements of an array of size 4.
numArray = map(int, input().split()) # Get the input
sum_integer = 0
# write your logic to add these 4 numbers here
for i in numArray:
sum_integer +=i
@sanikamal
sanikamal / array_sum.py
Created September 15, 2017 09:29
Python program to print the sum of all the elements of an array of size N where N can be any integer between 1 and 100. 1≤N≤100
N = input()
# Get the input
numArray = map(int, input().split())
sum_integer = 0
# Write the logic to add these numbers here
for i in numArray:
sum_integer +=i
@sanikamal
sanikamal / square_arr_sum.py
Created September 15, 2017 09:31
Python program to print the sum of squares of the elements of an array of size N. N can be any integer between 1 and 100. 1≤N≤100
N = input()
# Get the input
numArray = map(int, input().split())
sum_integer = 0
# Write the logic to add these numbers here
for i in numArray:
sum_integer += i**2
@sanikamal
sanikamal / range_int.py
Created September 15, 2017 09:36
Python3 program to list all the integers between two integers L and R (including L and R). L and R can be any integer between 1 and 100. 1≤L,R≤100
# Get L and R from the input
L, R = map(int, input().split())
# the logic to print all integers between L and R
for i in range(L,R+1):
print(i, end=" ")
@sanikamal
sanikamal / add_list.py
Created September 15, 2017 09:41
Python3 program to add the corresponding elements of two arrays, each of size N and print the sums. N can be any integer between 1 and 100. 1≤N≤100
N = int(input())
# Get the array
numArray1 = list(map(int, input().split()))
numArray2 = list(map(int, input().split()))
sumArray = []
# the logic
for i in range(N):