Created
February 26, 2017 18:27
-
-
Save Zoha131/df006c7ea7ae6ac8f4e58a2ac3c3ab39 to your computer and use it in GitHub Desktop.
Problems in code_marshal solutions.
This file contains hidden or 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
/* | |
* ===================================================================================== | |
* | |
* Filename: pyramid.c | |
* | |
* Description: code_marshal | |
* | |
* Version: 1.0 | |
* Created: 02/13/2017 04:00:10 AM | |
* Revision: none | |
* Compiler: gcc | |
* | |
* Author: zoha | |
* Organization: | |
* | |
* ===================================================================================== | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int i, j, t, k,m,n; | |
scanf("%d", &t); | |
for(i=1; i<=t; i++) | |
{ | |
scanf("%d", &k); | |
for(j = 0; j< k; j++ ) | |
{ | |
for(m = k-1; m>j; m--) | |
{ | |
printf(" "); | |
} | |
for(n=0; n<=j*2; n++) | |
{ | |
printf("*"); | |
} | |
printf(" \n"); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
This file contains hidden or 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
/* | |
* ===================================================================================== | |
* | |
* Filename: pyramid.c | |
* | |
* Description: code_marshal | |
* | |
* Version: 1.0 | |
* Created: 02/13/2017 04:00:10 AM | |
* Revision: none | |
* Compiler: gcc | |
* | |
* Author: zoha | |
* Organization: | |
* | |
* ===================================================================================== | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int i, j, n, m; | |
unsigned short int t,k; | |
scanf("%hu", &t); | |
for(i=1; i<=t; i++) | |
{ | |
scanf("%hu", &k); | |
for(j = 0; j< k; j++ ) | |
{ | |
for(m = k-1; m>j; m--) | |
{ | |
printf(" "); | |
} | |
for(n=0; n<=j*2; n++) | |
{ | |
printf("*"); | |
} | |
printf("\n"); | |
} | |
for(j = k-2; j>=0; j-- ) | |
{ | |
for(m = k-1; m>j; m--) | |
{ | |
printf(" "); | |
} | |
for(n=0; n<=j*2; n++) | |
{ | |
printf("*"); | |
} | |
printf("\n"); | |
} | |
printf("\n"); | |
} | |
return 0; | |
} |
This file contains hidden or 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
/* | |
* ===================================================================================== | |
* | |
* Filename: u_diff_array.c | |
* | |
* Description: array reverse | |
* | |
* Version: 1.0 | |
* Created: 02/24/2017 03:51:39 AM | |
* Revision: none | |
* Compiler: gcc | |
* | |
* Author: YOUR NAME (), | |
* Organization: code_marshal | |
* | |
* ===================================================================================== | |
*/ | |
#include <stdlib.h> | |
#include <stdio.h> | |
int main() | |
{ | |
int i,j,k,l,N,t, temp; | |
scanf("%d", &t); | |
for(l=0; l<t;l++) | |
{ | |
scanf("%d",&N); | |
int n_array[N]; | |
for(i=0; i<N; i++) | |
{ | |
scanf("%d", &n_array[i]); | |
} | |
j = i-1; | |
i=0; | |
while(i<j) | |
{ | |
temp = n_array[i]; | |
n_array[i] = n_array[j]; | |
n_array[j] = temp; | |
j--; | |
i++; | |
} | |
printf("%d", n_array[0]); | |
for(k = 1; k<N; k++) | |
{ | |
printf(" %d", n_array[k]); | |
} | |
printf("\n"); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment