C How To Program 16
C How To Program 16
if (n < 0) {
printf("Factorial is not defined for negative numbers.\n");
} else {
printf("%d! = %llu\n", n, factorial(n));
}
return 0;
}
c.
#include <stdio.h>
return 0;
}
#include <stdio.h>
return ex;
}
int main() {
double x;
int n;
return 0;
}
#include <stdio.h>
int main() {
double current_population;
double growth_rate;
double population;
double increase;
double double_population;
double quadruple_population;
return 0;
}
Enter the current world population: 7800000000
Enter the annual growth rate (as a percentage): 1.1
Year Projected Population Annual Increase
-----------------------------------------------------------
1 7885800000.00 85800000.00
2 7972543800.00 86743800.00
3 8060231981.80 87688181.80
...
#include <stdio.h>
temp = digits[1];
digits[1] = digits[3];
digits[3] = temp;
}
void decrypt(int *digits) {
// Swap the first digit with the third, and the
second digit with the fourth
int temp = digits[0];
digits[0] = digits[2];
digits[2] = temp;
temp = digits[1];
digits[1] = digits[3];
digits[3] = temp;
int main() {
int digits[4];
// Encrypt
readDigits(digits);
encrypt(digits);
printf("Encrypted number: ");
printDigits(digits);
// Decrypt
decrypt(digits);
printf("Decrypted number: ");
printDigits(digits);
return 0;
}
The end