Write a program for inviting all students of your class in your birthday party according to a given friend list of students of your class.Your program must ask the friend list of each roll number from you .You personally want to inform minimum number of students of your class as you are shy in talking and you want that full class must be informed. If you inform a student he will inform all his friends according to the friend list given by you and you don’t have inform his friends.The program should be efficient and for loop should run as minimum as possible.Any student must not be informed twice in this program. The program should output the roll number of students you will have to inform and the total number of students you will inform.
Answers
Answer:
Mr. X's birthday is in next month. This time he is planning to invite N of his friends. He wants to distribute some chocolates to all of his friends after party. He went to a shop to buy a packet of chocolates.
At chocolate shop, each packet is having different number of chocolates. He wants to buy such a packet which contains number of chocolates, which can be distributed equally among all of his friends.
Help Mr. X to buy such a packet.
Input:
First line contains T, number of test cases.
Each test case contains two integers, N and M. where is N is number of friends and M is number number of chocolates in a packet.
Output:
In each test case output "Yes" if he can buy that packet and "No" if he can't buy that packet.
Constraints:
1<=T<=20
1<=N<=100
1<=M<=10^5
Explanation:
Test Case 1:
There is no way such that he can distribute 14 chocolates among 5 friends equally.
Test Case 2:
There are 21 chocolates and 3 friends, so he can distribute chocolates eqally. Each friend will get 7 chocolates.
Hope it will help u
Thank u ❤️❤️
Answer:
#include<stdio.h>
int main()
{
int t,n,i;
long int m;
scanf("%d",&t);
for(i=1;i<=t;i++)
{
scanf("%d",&n);
scanf("%ld",&m);
if(m%n==0)
printf("Yes\n");
else
printf("No\n");
}
return 0;
}