Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
A_141124Burbuja
//Title of this code #include <stdio.h> #include <stdlib.h> #include <time.h> #define _T 100 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; } printf("\n\n"); for(srand(time(NULL)) , i = 0 ; i < _T ; i++) { v[i] = a + rand() % (b - a + 1); } for(i = 0 ; i < _T ; i++) { if(i % 10 == 0 && i) { printf("\n"); } printf("%5ld", 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("%5ld", v[i]); } return 0; }
run
|
edit
|
history
|
help
0
MATRICES TRIANGULARES
PRACTICE FINAL 2
day 3 integer manipulation
FloatFahrenheitToCelcius
CS HW2
Sizeof void
SortedMerge
LinkedListTest
18BCE2182 MIDTERM PART-B CRITICAL
Spring 2017 Lab 4 v1