0

If i want to reduce linea of this code what are the loop option that i can use for that?

void main() { int num1, num2, j, i, count1=0, count2=0, a, b, Tot=0, k, l; printf("Enter the 1st number:"); scanf("%d", &num1); printf("Enter the 2nd number:"); scanf("%d", &num2); if (num1>0 && num2>0){ for(i=2; i<num1; i++){ if (num1%i==0){ count1=count1+1; } } for(j=2; j<num2; j++){ if (num2%j==0){ count2=count2+1; } } if (num1==1) count1=1; if (num2==1) count2=1; if (count1>0 && count2>0){ if (num1>=num2){ a=num2; b=num1; } else{ a=num1; b=num2; } for(k=a+1; k<b; k++){ int count3=0; for(l=2; l<k; l++){ if (k%l==0){ count3=count3+1; } } if (count3==0){ Tot=To

9th Jul 2020, 4:23 PM
narthana wickramasinghe
narthana wickramasinghe - avatar
2 Respostas
+ 2
Can you explain what your code is supposed to do? Save the person who wants to help you the trouble of first pondering over your code.
9th Jul 2020, 4:40 PM
HonFu
HonFu - avatar
0
To calculate the sum of prime numbers between non prime numbers
9th Jul 2020, 4:42 PM
narthana wickramasinghe
narthana wickramasinghe - avatar