string multiply(string num1, string num2) { // special cases if(num1.compare("0")==0 || num2.compare("0")==0) return "0"; // general int n2=num2.size(); string sum="0"; for(int i=n2-1;i>=0;i--){ string mul = strmul(num1, num2[i]); sum = strsum(sum, mul, n2-1-i); } // return return sum; }
void main() { char s[100],p[100]; int i,k; printf("enter the strings of equal length u want to add\n"); scanf("%s%s",s,p); k=valid(s); if(k==0){ printf("invalid input"); exit(0);} k=valid(p); if(k==0){ printf("invalid input"); exit(0);} strsum(s,p); }
void main() { char p[100]; int i,k; printf("enter a number"); scanf("%s",p); int n=strsum(p); printf("enter the no.of times\n"); scanf("%d",&k); if(k==0){ printf("not divisible"); exit(0);} for(i=0;i<k;i++) printf("%s",p); if(n==1) printf(" divisible by 3"); else { if(k%3==0) printf(" divisible"); else printf("not divisible"); } }