Skip to content

Instantly share code, notes, and snippets.

View jamby77's full-sized avatar

Petar Dzhambazov jamby77

View GitHub Profile
#include <stdio.h>
int main()
{
// 4ete 4isla do sre6tane na 0 i namira max 4islo, koeto ne se deli na 3.
int n, max = -1000;
do {
printf("vyvedete chislo: ");
scanf("%d", &n);
if (n % 3 != 0 && n > max) {
#include <stdio.h>
int main()
{
// която чете числа до срещане на 0 и намира колко пъти поредното въведено число е по голямо от предходното
// ВХ: 20,15,7,10,13,4,19,0 -> изх.3
int curr = 0, prev = 0, br=0;
printf("vyvedete chislo: ");
scanf("%d", &curr);
while (curr != 0){
if (curr > prev && prev != 0) {
@jamby77
jamby77 / praktikum_menu_display.c
Last active December 19, 2015 04:09 — forked from anonymous/praktikum_menu_display.c
Sample program
#define _CRT_SECURE_NO_DEPRECATE
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
//
// АКО ПОЛЗВАТЕ НЯКОЯ ЧАСТ ОТ ТОЗИ ФАЙЛ, ПОСТАРАЙТЕ СЕ ДА ИЗТРИЕТЕ КОМЕНТАРИТЕ!!!
//
const int MENU_LENGTH = 6; // дължина на менюто, по-лесно е за обхождане ако е дефинирана
enum menu
@jamby77
jamby77 / main.c
Created July 3, 2013 16:51
Tema 5
/*
* File: main.c
* Author: pp
*
* Created on June 27, 2013, 5:29 PM
*/
#include <stdio.h>
#include <stdlib.h>
#include <sys/unistd.h>
class Sample_Model_Observer
{
protected $colToAdd = 'colname';
/**
* @param Varien_Event_Observer $observer
*/
public function urapidflow_profile_action( $observer )
{
$action = $observer->getData( 'action' );
$profile = $observer->getData( 'profile' );
@jamby77
jamby77 / Main.java
Created October 27, 2016 20:37
loop with 'modulo'
public static void main(String[] args) {
int noOfRows = 1234;
for (int i = 0; i < noOfRows; i++) {
if (i > 0 && i % 18 == 0) {
System.out.println(1);
}
}
}
#include <iostream>
using namespace std;
int main(int argc, const char * argv[]) {
int N, t, a,b,c;
int Nmax = 1000000; // po uslovie N ne moje da e poveche ot tova chislo
int tMax = 10000; // vs chislo sled N ne moje da e poveche ot tova
cin >> N;
cout << "N is: " << N << "\n";
#include <iostream>
#include <string>
#include <math.h>
using namespace std;
string decimalToBinary(unsigned int a)
{
string b = "";
if (a == 0)
void minMax(int arr[],int size) {
int min, max, minIdx, maxIdx;
for (int i = 0; i < size; i++)
{
if (i == 0) {
// при първото завъртане, слагаме стойността на мин и макс като стойността на
// първия елемент на масива и прескачаме на следващото завъртане
min = max = arr[i];
minIdx = maxIdx = 0;
#include <iostream>
#include <string>
using namespace std;
void toBin(int n)
{
if (n == 0 || n == 1)
{
cout << n;
return;