Posts

Find remainder Codechef problem solution in C language with logic

Image
 First discuss some topic  Types of Loops : Primarily, there are three types of loop in c language: 1.While loop 2.do-while loop 3.for loop We will look into this one by one While Loop While(condition is true) { // Code                    // The block keeps executing as long as the condition is true // Code } Here the code --> #include <stdio.h>  int main() { // Read the number of test cases. int T; scanf("%d", &T); while (T--) { // Read the input a, b int a, b; scanf("%d %d", &a, &b); // Compute the ans. // Complete this line. int ans = a%b; printf("%d\n", ans); } return 0; } So here the logic is we need find remainder so we use a%b its give the remaider when a%b==0 its means a is proper multiplier of b or we can say b is proper divisor of a.                                              Thank you