AlonsoPL 0 Newbie Poster

Functionality
Read 2 numbers
Print multiplication as in following example:
3333
1111
----
***3333
**3333
*3333
3333
----
3702963

Prepare following functions
Modulo division (you cannot use '%')
Mulitplication
Print a number with leading and "following" spaces

I have it:

#include <cstdlib>
#include <iostream>
#include "conio.h"

using namespace std;

int main(int argc, char *argv[])
{

int num1=0,num2=0,res=0;
printf("Please, enter a number: ");
scanf("%d",&num1);
printf("\n By this other number: ");
scanf("%d",&num2);
for(int cont=0;cont<num2;cont++)
{
res=res+num1;
}
printf("The result is: %d \n",res);

system("PAUSE");
return EXIT_SUCCESS;
}


Please I need to do that in C language, I think the best way to do it is converting to a array the second string that you enter by keyboard, then we must multiplicathe that array one by one to have the partial multiplications. Finally we have to put it in the correct position (I don't know how to do it) and print the multiplication result at the end.

Thank you for your help!!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.