I got it to print the smallest pair for the input number.
but i need also to do this proccess for every number smaller then the input to 1.
Code:
#include <stdio.h>
int main(){
int num;
int index,tndex,kndex,jndex;
int flag_1,flag_2,same_num;
int sum;
int smallest,smallest_ever,smallest_ever_2;
sum=0;
same_num=-1;
smallest=-1;
smallest_ever=2147483647;
smallest_ever_2=2147483647;
printf("enter number\n");
scanf("%d",&num);
for(index=1;index<num;index++){ //start for main number
flag_1=0;
flag_2=0;
tndex=index;
kndex=num-tndex;
sum=0;
for(jndex=1;jndex<tndex;jndex++){//start abbondence check for first num (tndex)
if (tndex%jndex==0){
sum=sum+jndex;
}
if (tndex<sum){
flag_1=1;
}
}//end abbondence check for first num
sum=0;
for(jndex=1;jndex<kndex;jndex++){//start abbondence check for second num (kndex)
if (kndex%jndex==0){
sum=sum+jndex;
}
if (kndex<sum){
flag_2=1;
}
}//end abbondence check for first num
if ((flag_2==1)&&(flag_1==1)){ //start flag check
if (kndex>=tndex){
smallest=tndex;
if ((smallest<smallest_ever)&&(smallest>1)){
smallest_ever=smallest;
smallest_ever_2=kndex;
}
}
else
{
smallest=kndex;
if ((smallest<smallest_ever)&&(smallest>1)){
smallest_ever=smallest;
smallest_ever_2=tndex;
}
}
if(same_num!=smallest_ever){
printf("%d %d",smallest_ever,smallest_ever_2);
}
same_num=smallest_ever;
}//end flag check
}//end for main number
return 0;
}//end main