Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int add(int n1, int n2);
- int main()
- {
- int n1,n2,product=0,i;//variable declaration
- printf("Enter the first number: ");
- scanf("%d",&n1); //Takes input from the user for n1
- printf("Enter the first number: ");
- scanf("%d",&n2); //Takes input from the user for n2
- for(i=0; i<n2; i++){
- product=add(product,n1);
- }
- printf("product of %d and %d are: %d\n",n1,n2,product);
- getch();
- return 0;
- }
- int add(int num1,int num2){
- int i;
- for(i=0; i<num2; i++)
- num1++;
- return num1;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement