Skip to content

Instantly share code, notes, and snippets.

View thinkphp's full-sized avatar
💭
If I have seen further it is only by standing on the shoulders of giants. Newton

Adrian Statescu thinkphp

💭
If I have seen further it is only by standing on the shoulders of giants. Newton
View GitHub Profile
@thinkphp
thinkphp / pointers.c
Created September 20, 2026 13:17
pointers.c
#include <stdio.h>
int swap(int a, int b) {
int temp = a;
a = b;
b = a;
}
@thinkphp
thinkphp / matrice-static.c
Created September 20, 2026 12:52
matrice STATICA
#include <stdio.h>
#define LINII 3
#define COLOANE 3
void afisare(int m[LINII][COLOANE]) {
for(int i = 0; i < LINII; ++i) {
for(int j = 0; j < COLOANE; ++j) {
@thinkphp
thinkphp / matrix-dynamic-allocation.c
Created September 20, 2026 12:51
Matricea alocata dinamic
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char const *argv[])
{
int linii, coloane;
printf("Numarul de linii: ");
scanf("%d", &linii);
@thinkphp
thinkphp / reverse.c
Created September 20, 2026 12:17
algoritms-reverse.c
#include <stdio.h>
void afiseaza(int v[], int n) {
for(int i = 0; i < n; ++i) {
printf("%d ", v[i]);
}
printf("\n");
}
@thinkphp
thinkphp / min.max.c
Created September 20, 2026 12:08
Calcul Min MAx
#include <stdio.h>
int main(int argc, char const *argv[])
{
int numere[] = {-23,5,12,33,101,47,3311,331};
// 1....rest
int n = sizeof(numere) / sizeof(numere[0]);
//pornim presupunand ca primul element este si minimum si maximum
#include <stdio.h>
//de implementat
//{64,34,25,12,11,90};
// i i+1
void afisare(int v[], int n) {
for(int i = 0; i < n; ++i) {
printf("%d ",v[i]);
@thinkphp
thinkphp / cautare-liniara.c
Created September 20, 2026 11:30
cautare liniara
#include <stdio.h>
//Cautare liniara
int main(int argc, char const *argv[])
{
//declaram un array de numere intregi
int numbers[] = { 5, 12, 8, 120, 44, 7,123, 90};
@thinkphp
thinkphp / euclid.c
Created September 20, 2026 10:48
algoritmul lui Euclid
#include <stdio.h>
/*
Algoritmul lui Euclid
Cel mai mare divizor comun (a,b)
(10,3) = 1
(10,4) = 2
#include <stdio.h>
int main(int argc, char const *argv[])
{
int a = 24;//declar o variabila de tip intreg
int b = 2;//declar o variabila de tip intreg
int r = a;//declar o variabila de tip intreg
@thinkphp
thinkphp / exchange.variables.cpp
Created September 20, 2026 08:49
interschimbare-variabile
#include <iostream>
using namespace std;
int main(int argc, char const *argv[])
{
int a = 10,
b = 12;
cout<<"a = "<<a<<endl;