Skip to content
This repository has been archived by the owner on Jun 25, 2020. It is now read-only.

Едуард Златков ,10в клас,номер 10 #876

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions 2015-2016/V/10/02/task1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#include <stdio.h>
int main()
{
int i;
for(i=0;i<=255;i++)
{
printf("%c: %d\n",i,i);

}

return 0;
}
30 changes: 30 additions & 0 deletions 2015-2016/V/10/02/task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include<stdio.h>
#include<string.h>
int main()
{
char dumi[100];
while(1)
{
scanf("%s",dumi);
int lenght = strlen(dumi);
if(dumi[0] == 'S' && dumi[1] == 'T' && dumi[2] == 'O' && dumi[3] == 'P' && dumi[4] == '\0')
{
break;
}
int i;
for(i=0; i<lenght; i++)
{

if(dumi[i] >= 'a' && dumi[i] <= 'z')
{
dumi[i] -= 32;
}
}

printf("%s",dumi);
}



return 0;
}
34 changes: 34 additions & 0 deletions 2015-2016/V/10/02/task3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#include<stdio.h>
int main()
{
int array[1000];
int i=0;
for(; i <1000; i++)
{
scanf("%d",&array[i]);
if(array[i] == 42)
{
break;
}
}
int lenght = i;
for(i=0;i<lenght;i++)
{
int j=0;
for(; j<lenght-1; j++)
{
if(array[j] > array[j+1])
{
int b=array[j];
array[j]=array[j+1];
array[j+1]=b;
}
}
}
for(i=0;i<lenght;i++)
{
printf("\n%d",array[i]);
}
return 0;
}

27 changes: 27 additions & 0 deletions 2015-2016/V/10/02/task4.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<stdbool.h>

int main(void){

bool number[10] = { false };
int digit;
long n;


scanf("%ld", &n);

printf("povtarqshti se chisla(s):");

while (n > 0)
{
digit = n % 10;
if (number[digit] == true)
{
printf("%d ", digit);
}
number[digit] = true;
n /= 10;
}

return 0;
}
23 changes: 23 additions & 0 deletions 2015-2016/V/10/03/task1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#include <stdio.h>
#include <string.h>

int main()
{
int a,b,i;
scanf("%d",&a);

for(i=1;i<=a;i++)
{
for(b=1;b<=(2*i-1);b++)
{
printf("*");
}

printf("\n");
}


return 0;

}

27 changes: 27 additions & 0 deletions 2015-2016/V/10/03/task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include <stdio.h>
int main()
{
char str[50];
char *rev;
printf("vuvedi duma: ");
scanf("%s",str);
rev = strrev(str);

printf("obyrnatata dyma e: %s",rev);

return 0;
}
char *strrev(char *str)
{
char *p1, *p2;

if (! str || ! *str)
return str;
for (p1 = str, p2 = str + strlen(str) - 1; p2 > p1; ++p1, --p2)
{
*p1 ^= *p2;
*p2 ^= *p1;
*p1 ^= *p2;
}
return str;
}
42 changes: 42 additions & 0 deletions 2015-2016/V/10/03/task3.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#include <stdio.h>
#include <string.h>

int main()
{
char m;
char k[13];
char k2[13] = {'A','K','Q','J','T','9','8','7','6','5','4','3','2'};

int i,j;

do
{

scanf("%s",k);
}while(strlen(k)!=13);


do{


for(i=0;i<=12;i++)
{
for(j=0;j<=12;j++)
{
if(k2[j]==k[i])
{
m=k[j];
k[j]=k[i];
k[i]=m;
break;
}
}
}
}while(strcmp(k2,k) != 0);

printf("%s",k);
return 0;

}


27 changes: 27 additions & 0 deletions 2015-2016/V/10/04/task1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#include<stdio.h>
#include<stdbool.h>

int main(void){

bool number[10] = { false };
int digit;
long n;

//printf("Enter a number: ");
scanf("%ld", &n);

//printf("Repeated digit(s): ");

while (n > 0)
{
digit = n % 10;
if (number[digit] == true)
{
printf("%d ", digit);
}
number[digit] = true;
n /= 10;
}

return 0;
}
68 changes: 68 additions & 0 deletions 2015-2016/V/10/04/task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#include<stdio.h>


int main() {
int size = 3;
int matrix[3][3]; // = {{4,9,2},{3,5,7},{8,1,6}};
int row, column = 0;
int sum, sum1, sum2;
int flag = 0;

scanf("vuvedete chislata:");
for (row = 0; row < size; row++) {
for (column = 0; column < size; column++)
scanf("%d", &matrix[row][column]);
}


for (row = 0; row < size; row++) {
printf("\n");
for (column = 0; column < size; column++) {
printf("\t%d", matrix[row][column]);
}
}


sum = 0;
for (row = 0; row < size; row++) {
for (column = 0; column < size; column++) {
if (row == column)
sum = sum + matrix[row][column];
}
}


for (row = 0; row < size; row++) {
sum1 = 0;
for (column = 0; column < size; column++) {
sum1 = sum1 + matrix[row][column];
}
if (sum == sum1)
flag = 1;
else {
flag = 0;
break;
}
}


for (row = 0; row < size; row++) {
sum2 = 0;
for (column = 0; column < size; column++) {
sum2 = sum2 + matrix[column][row];
}
if (sum == sum2)
flag = 1;
else {
flag = 0;
break;
}
}

if (flag == 1)
printf("\nmagicheski kvadrat");
else
printf("\nne e magicheski kvadrat");

return 0;
}
Empty file.
28 changes: 28 additions & 0 deletions 2015-2016/V/10/05/task1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include <stdio.h>

int main()
{
int m=4, n=4, c, d, matrix[10][10], transpose[10][10];


//printf("vuvedi elementite na matricata\n");

for (c = 0; c < m; c++)
for(d = 0; d < n; d++)
scanf("%d",&matrix[c][d]);

for (c = 0; c < m; c++)
for( d = 0 ; d < n ; d++ )
transpose[d][c] = matrix[c][d];

//printf("Transponiraneto na matricata \n");

for (c = 0; c < n; c++) {
for (d = 0; d < m; d++)
printf("%d\t",transpose[c][d]);
printf("\n");
}

return 0;
}

18 changes: 18 additions & 0 deletions 2015-2016/V/10/05/task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <stdio.h>
#include <string.h>
int main(void)
{
char s[100], b[100];

//printf("napishete bukvi za da se proveri dali nizut s e palindrom\n");
gets(s);

strcpy(b,s);
strrev(b);

if (strcmp(s,b) == 0)
printf(" 1\n");
else
printf(" 0\n");
return 0;
}
Empty file.
24 changes: 24 additions & 0 deletions 2015-2016/V/10/06/task2.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# include <stdio.h>
# include <math.h>

int isExactSquare(float);

int main()
{
int n ;

//printf("Enter a number : ") ;
scanf("%d", &n) ;
printf("%d",isExactSquare(n)) ;
return 0 ;
}

int isExactSquare(float p) {
float m = sqrt(p) ;

if(m == (int)sqrt(p))
return 1 ;
else
return 0 ;
}

26 changes: 26 additions & 0 deletions 2015-2016/V/10/07/task1.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#include <stdio.h>


void rotr(int *a,int *b,int *c)
{
int n=*a;
*a=*c;
*c=*b;
*b=n;
}
int main()
{
int a,b,c,t;
int i=0;
scanf("%d",&a);
scanf("%d",&b);
scanf("%d",&c);
scanf("%d",&t);
do{
rotr(&a,&b,&c);
i++;
}while(i<t);

printf("%d %d %d",a,b,c);
return 0;
}
Loading