#include #include /* run this program using the console pauser or add your own getch, system("pause") or input loop */ void program4() { int x,y,t; do { printf("x = "); scanf("%d", &x); printf("y = "); scanf("%d", &y); t = x; x = y; y = t; printf("x : %d, y : %d \n", x, y); } while (x != 0 && y != 0); } void program5() { int nVowels = 0, nConsonants = 0, nOthers = 0; char ch; do { ch = getchar(); ch = toupper(ch); if(ch >= 'A' && ch <= 'Z'){ switch(ch){ case 'A': case 'E': case 'I': case 'O': case 'U': nVowels++; break; default: nConsonants++; } } else { nOthers++; } } while ( ch != '\n'); printf("nVowels: %d\n", nVowels); printf("nConsonants: %d\n", nConsonants); printf("nOthers: %d\n", nOthers - 1); } void program6() { int code; for(code = 0; code <= 255; code++){ printf("%c : %d, %o, %X\n", code, code, code, code); if(code != 0 && code % 20 == 0) { printf("Type to continuous..."); getchar(); }; } } void program7() { char char1, char2, t; int dif, code; printf("Input char 1 : "); char1 = getchar(); getchar(); printf("Input char 2 : "); char2 = getchar(); if(char1 > char2){ t = char1; char1 = char2; char2 = t; } dif = char2 - char1; printf("Difference = %d\n", dif); for(code = char1; code <= char2; code++){ printf("%c : %d, %o, %X\n", code, code, code, code); } } int main() { program7(); // chay baitap nao thi thay function do -> program7() -> program4() return 0; }