Advertisement
Guest User

Untitled

a guest
Oct 21st, 2019
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <string.h>
  4.  
  5. int main(){
  6.  
  7. int num;
  8. float *temps;
  9.  
  10. printf("How many temperatures would you like to read? ");
  11. scanf("%d", &num);
  12.  
  13. temps = malloc(sizeof(float)*num);
  14.  
  15. for (int i = 0; i < num; i++){
  16. printf("Enter a temperature: ");
  17. scanf("%f", &temps[i]);
  18. }
  19.  
  20. for (int j = num-1; j>-1; j--){
  21. printf("%f, ", temps[j]);
  22. }
  23.  
  24.  
  25.  
  26. return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement