#include <stdio.h>
#include <stdlib.h>
int main()
{
begin();
}
int begin()
{
long int b,res1,res2,res3;
int a,c,d,e,f,i;
printf("Enter first number: ");
scanf("%d",&a);
printf("Enter second number: ");
scanf("%ld",&b);
c=b%10;
d=b%100-c;
e=b/100;
res1=a*c;
res2=a*d;
res3=a*e;
f=a*b;
printf("\n\n\n");
printf(" %d\n",a);
printf("x\n");
printf(" %d\n",b);
printf("________\n");
printf(" %ld\n",res1);
printf("+ %ld\n",res2);
printf(" %ld\n",res3);
printf("_______\n");
printf("%d\n",f);
system("PAUSE");
return 0;
}
hi i need to do the calculator above,code works fine,nothing special and very simple,but where were ger the subresult in res1,res2 and res3,is only for 3 multiple numbers,i need to do the printf with for loop ,so that would be flexible and printed as much numbers as it need no only 3.Can someone give some solutions/exaples ?Thank you.