Advertisement
adventuretimeh

selezione due viee

Dec 9th, 2019
180
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5. // se metti un numero con il meno esce sia la meta e il triplo//
  6.  
  7. int main(int argc, char *argv[]) {
  8. int num,doppio,triplo;
  9. float meta;
  10. printf("\ndammi un numero");
  11. scanf("%d",&num);
  12. if(num>0)
  13. {
  14. printf("\nnumero %d",num);
  15. doppio = num*2;
  16. printf("\n doppio %d",doppio);
  17. }
  18. else
  19.  
  20. {
  21. meta=(float)num/2;
  22. printf ("la meta del num vale %f",meta);
  23. }
  24. triplo=num*3;
  25. printf("\n triplo vale %d",triplo);
  26.  
  27.     return 0;
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement