Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
B_141125_Burbuja
//Title of this code #include <stdio.h> #include <stdlib.h> #include <time.h> #define _T 10000 int main(void) { long v[_T]; long a, b; short i, j; printf("Valor de a ... "); scanf(" %ld", &a); printf("Valor de b ... "); scanf(" %ld", &b); if(a > b) { a ^= b; b ^= a; a ^= b; } for(srand(time(NULL)) , i = 0 ; i < _T ; i++) { v[i] = a + rand() % (b - a + 1); } printf("\n\n"); for(i = 0 ; i < _T ; i++) { if(i % 10 == 0 && i) { printf("\n"); } printf("%6ld", v[i]); } for(i = 0 ; i < _T ; i++) { for(j = i + 1 ; j < _T ; j++) { if(v[i] > v[j]) { v[i] ^= v[j]; v[j] ^= v[i]; v[i] ^= v[j]; } } } printf("\n\n"); for(i = 0 ; i < _T ; i++) { if(i % 10 == 0 && i) { printf("\n"); } printf("%6ld", v[i]); } return 0; }
run
|
edit
|
history
|
help
0
EXercice
CO Assignment 1 Question 1
Area & Perimeter of Circle
Bool datatype Operation for GCC
Print Bash Version.c
5 trabajo semanal 4
Stub Program for Problem 3 HW 2
Calculate Area of Circle
eliminate_duplicates.c
Project 3 part 2 Book v0.5