This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <stdlib.h> | |
#include <conio.h> | |
#include <stdbool.h> | |
#define PI 3.141592653589793 | |
void clear(){ | |
#if defined(__linux__) || defined(__unix__) || defined(__APPLE__) | |
system("clear"); | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main() { | |
int x, y, z, q, pom; | |
printf("Unesite vreme uzletanja aviona:\n"); | |
scanf("%d %d %d", &x, &y, &z); | |
printf("Koliko je sekundi avion proveo u letu?\n"); | |
scanf("%d", &q); | |
z += q; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from numpy import exp, array, random, dot | |
class NeuralNetwork: | |
def __init__(self): | |
random.seed(1) | |
self.weights = 2 * random.random((3, 1)) - 1 | |
def __sigmoid(self, x): | |
return 1 / (1 + exp(-x)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
operators = {'(': 0, ')': 0, '+': 1, '-': 1, '*': 2, '/': 2, '%': 2} | |
stack = [] | |
postfix = [] | |
expression = input('Enter your expression: ').split() | |
for ch in expression: | |
if ch in operators: | |
if ch is ')': | |
while stack and stack[-1] is not '(': |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from gi.repository import Gtk | |
class MainWindow(Gtk.Window): | |
def __init__(self): | |
Gtk.Window.__init__(self, title="Postfix") | |
self.set_border_width(10) | |
self.set_size_request(250, 150) | |
# Layout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Implementacija dva steka | |
* preko jednog niza | |
*/ | |
#include <stdio.h> | |
#define SIZE 10 | |
int Stack[SIZE], top1 = -1, top2 = SIZE; | |
// Da li je stek pun |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
def leftmostone(x): | |
return math.floor(math.log2(x)) | |
def podeli(a, b): | |
return int(leftmostone(a) == leftmostone(b)) | |
a = int(input('Unesi broj: ')) | |
b = int(input('Unesi delitelj: ')) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using Gtk; | |
class ElementaryFileViewer : Window { | |
TextView text_view; | |
public ElementaryFileViewer() { | |
var header = new HeaderBar (); | |
header.title = "Elementary OS"; | |
header.subtitle = "An Elementary OS App"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Zadatak 1 | |
reverse' :: [a] -> [a] | |
reverse' [] = [] | |
reverse' (x:xs) = reverse' xs ++ [x] | |
// Zadatak 2 | |
unique' :: (Eq a) => [a] -> [a] | |
unique' [] = [] | |
unique' (x:xs) = x : unique' (filter ((/=) x) xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::env; | |
use std::fs; | |
fn main() { | |
let args: Vec<_> = env::args().collect(); | |
let filename = &args[1]; | |
let contents = fs::read_to_string(filename).expect("Problem reading the file"); | |
let transformed: String = contents.chars().map(|c| ascii_char(c)).collect(); | |
OlderNewer