Advertisement
jasperlow

Untitled

Jan 14th, 2020
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.21 KB | None | 0 0
  1. /******************************************************************************
  2.  
  3. Online C Compiler.
  4. Code, Compile, Run and Debug C program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <stdio.h>
  10.  
  11. int main()
  12. {
  13. printf("Hello World\n");
  14. int num1,num2,num3; // i ready to store 3 number, they are integer, so i pick int
  15. float numSum; // i ready to do addition, i must store decimals, so i pick float
  16. printf("Give me a number : "); // give me 1st number
  17. scanf("%d", &num1);//i will accept using scanf %d
  18. printf("Give me a number : "); // give me 2nd number
  19. scanf("%d", &num2);//i will accept using scanf %d
  20. printf("Give me a number : "); // give me 3rd number
  21. scanf("%d", &num3);//i will accept using scanf %d
  22. printf("See see har my numbers %d %d %d\n", num1, num2, num3);
  23. numSum=num1+num2+num3; // now i have 3 number, i do addition ler, add all integers and store into float
  24. printf("See see har my sum of %d+%d+%d=%.2f\n", num1, num2, num3,numSum); // format my flot
  25. return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement