diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e43b0f9 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.DS_Store diff --git a/adarsh1498/even.cpp b/adarsh1498/even.cpp new file mode 100644 index 0000000..423f3e2 --- /dev/null +++ b/adarsh1498/even.cpp @@ -0,0 +1,17 @@ +#include +using namespace std; + +int main() +{ + int n; + + cout << "Enter an integer: "; + cin >> n; + + if ( n % 2 == 0) + cout << n << " is even"; + else + cout << n << " is odd"; + + return 0; +} diff --git a/adarsh1498/sum.cpp b/adarsh1498/sum.cpp new file mode 100644 index 0000000..18a02b9 --- /dev/null +++ b/adarsh1498/sum.cpp @@ -0,0 +1,16 @@ +#include +using namespace std; + +int main() +{ + int N1,N2,result; + + cout << "Enter two integers: "; + cin >> N1 >> N2; + + result = N1 + N2; + + cout << N1 << " + " << N2 << " = " << result; + + return 0; +} diff --git a/even-odd/evenodd.java b/even-odd/evenodd.java new file mode 100644 index 0000000..a0585d6 --- /dev/null +++ b/even-odd/evenodd.java @@ -0,0 +1,13 @@ +//created by- Siddharth Saurabh (https://github.com/siddhartthecoder) +import java.util.*; +class evenodd { + public static void main(String args[]) throws Exception { + Scanner sc = new Scanner(System.in); + System.out.println("Enter your number:"); + int n = sc.nextInt(); + if(n%2==0) + System.out.println(n+" is even"); + else + System.out.println(n+" is odd"); + } +} diff --git a/hacktoberfun b/hacktoberfun new file mode 160000 index 0000000..824bece --- /dev/null +++ b/hacktoberfun @@ -0,0 +1 @@ +Subproject commit 824bece0bb0c61829cfe8eb31eb49706d7e9bec2 diff --git a/kbc/sum.cpp b/kbc/sum.cpp new file mode 100644 index 0000000..a0e2794 --- /dev/null +++ b/kbc/sum.cpp @@ -0,0 +1,12 @@ +#include +using namepsace std; + +int main(){ + int a,b; + cout<<"Enter a number: "; + cin>>a; + cout<<"Enter another number: "; + cin>>b; + cout<<"sum is "< +int main() { + + int n; + printf("Enter a number: "); + scanf("%d",&n); + if(1&n) + printf("%d is an odd number\n",n); + else + printf("%d is an even number\n",n); + + return 0; + +} diff --git a/nghminh163/return-odd-even.go b/nghminh163/return-odd-even.go new file mode 100644 index 0000000..dcb96ca --- /dev/null +++ b/nghminh163/return-odd-even.go @@ -0,0 +1,17 @@ +package main + +import "fmt" + +func main(){ + + fmt.Print("Input number- ") + var number int + fmt.Scanln(&number) + + + if(number%2!=0){ + fmt.Println(number,"is odd number") + }else{ + fmt.Println(number,"is even number") + } +} \ No newline at end of file diff --git a/nghminh163/sum.go b/nghminh163/sum.go new file mode 100644 index 0000000..480eed1 --- /dev/null +++ b/nghminh163/sum.go @@ -0,0 +1,11 @@ +package main + +import "fmt" + +func sum(a, b int) int{ + return a+b +} + +func main() { + fmt.Print(sum(1,2)) +} diff --git a/robot/helloberfun.py b/robot/helloberfun.py new file mode 100644 index 0000000..078eb57 --- /dev/null +++ b/robot/helloberfun.py @@ -0,0 +1,70 @@ +import curses +from curses import KEY_RIGHT, KEY_LEFT, KEY_UP, KEY_DOWN +from random import randint + + +curses.initscr() +win = curses.newwin(20, 60, 0, 0) +win.keypad(1) +curses.noecho() +curses.curs_set(0) +win.border(0) +win.nodelay(1) + +key = KEY_RIGHT +score = 0 + +snake = [[4,10], [4,9], [4,8]] +food = [10,20] + +win.addch(food[0], food[1], '*') + +while key != 27: + win.border(0) + win.addstr(0, 2, 'Score : ' + str(score) + ' ') + win.addstr(0, 27, ' SNAKE ') + win.timeout(150 - (len(snake)/5 + len(snake)/10)%120) + + prevKey = key + event = win.getch() + key = key if event == -1 else event + + + if key == ord(' '): + key = -1 + while key != ord(' '): + key = win.getch() + key = prevKey + continue + + if key not in [KEY_LEFT, KEY_RIGHT, KEY_UP, KEY_DOWN, 27]: + key = prevKey + + + snake.insert(0, [snake[0][0] + (key == KEY_DOWN and 1) + (key == KEY_UP and -1), snake[0][1] + (key == KEY_LEFT and -1) + (key == KEY_RIGHT and 1)]) + + + if snake[0][0] == 0: snake[0][0] = 18 + if snake[0][1] == 0: snake[0][1] = 58 + if snake[0][0] == 19: snake[0][0] = 1 + if snake[0][1] == 59: snake[0][1] = 1 + + + if snake[0] in snake[1:]: break + + + if snake[0] == food: + food = [] + score += 1 + while food == []: + food = [randint(1, 18), randint(1, 58)] + if food in snake: food = [] + win.addch(food[0], food[1], '*') + else: + last = snake.pop() + win.addch(last[0], last[1], ' ') + win.addch(snake[0][0], snake[0][1], '#') + +curses.endwin() +print("\nScore - " + str(score)) +print("http://bitemelater.in\n") diff --git a/shashi/sort.py b/shashi/sort.py new file mode 100644 index 0000000..df84ec2 --- /dev/null +++ b/shashi/sort.py @@ -0,0 +1,7 @@ +#call this function with a list and it will return a sorted list + +def sort(a): + return sorted(a) + +# testing +print(sort([4,5,8,5,2,2,3])) \ No newline at end of file diff --git a/sort.cpp/a.out b/sort.cpp/a.out new file mode 100755 index 0000000..b05122e Binary files /dev/null and b/sort.cpp/a.out differ diff --git a/sort.cpp/sort.cpp b/sort.cpp/sort.cpp new file mode 100644 index 0000000..1f42225 --- /dev/null +++ b/sort.cpp/sort.cpp @@ -0,0 +1,24 @@ +#include +using namespace std; +int main() +{ + long long int size; + vector v; + cout<<"Please enter the size of the array:- "<>size; + cout<<"Please enter the numbers one by one:-"<>value; + v.push_back(value); + } + sort(v.begin(),v.end()); + cout<<"Array in sorted order is:- "; + for(long long int i=0;i +using namespace std; + +int main() +{ + int N1,N2,result; + + cout << "Enter two integers: "; + cin >> N1 >> N2; + + result = N1 + N2; + + cout << N1 << " + " << N2 << " = " << result; + + return 0; +} diff --git a/sum__two__numbers/sum.cpp b/sum__two__numbers/sum.cpp new file mode 100644 index 0000000..5057bfc --- /dev/null +++ b/sum__two__numbers/sum.cpp @@ -0,0 +1,12 @@ +#include +using namespace std; +int main() +{ + long long int first,second; + cout<<"Please enter the first number:- "<>first; + cout<<"Please enter the second number:- "<>second; + cout<<"The sum of the two number is:- "< + +void main(){ + printf("\n*****Check wether a number is even or odd*****\n\n\n"); + + int a; + + printf("Enter a number:\n"); + scanf("%d", &a); + + if (a % 2 == 0) + printf("--->The number you entered is even\n"); + else + printf("--->The number you entered is odd\n"); +}