Advertisement
ShadmanTaqi

sadasd

Mar 18th, 2021
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. int add(int n1, int n2);
  4. int main()
  5. {
  6. int n1,n2,product=0,i;//variable declaration
  7. printf("Enter the first number: ");
  8. scanf("%d",&n1); //Takes input from the user for n1
  9. printf("Enter the first number: ");
  10. scanf("%d",&n2); //Takes input from the user for n2
  11. for(i=0; i<n2; i++){
  12. product=add(product,n1);
  13. }
  14. printf("product of %d and %d are: %d\n",n1,n2,product);
  15. getch();
  16. return 0;
  17. }
  18. int add(int num1,int num2){
  19. int i;
  20. for(i=0; i<num2; i++)
  21. num1++;
  22. return num1;
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement