Skip to main content

Find Remainder || Codechef || FLOW002 || Programming using C++

Problem

Write a program to find the remainder when an integer A is divided by an integer B.

Input

The first line contains an integer T, the total number of test cases. Then T lines follow, each line contains two Integers A and B.

Output

For each test case, find the remainder when A is divided by B, and display it in a new line.

Constraints

  •  T  1000
  •  A,B  10000

Sample 1:

Input
Output
3 
1 2
100 200
40 15
1
100
10


ANSWER:- 

#include <iostream>

using namespace std;

int main(){

    int a,b;

    int t;

    cin>>t;

    for(int i=0 ; i<t ; i++){

    cin>>a>>b;

    int c = a%b;

    cout<<c<<endl;

    }

    return 0;

}

Comments

Popular posts from this blog

Web Based Technologies and Multimedia Applications || NPTEL WEEK 1 ASSIGNMENT SOLUTIONS

1.) The following are different ways of sharing information through Internet   Posting to Social Network   Uploading to cloud storage such as Google Drive   Sending through a mailing list   All of the above Answer: All of the above  2.) The following is a website where entries are written as commentary or news on a particular subject such as food, politics, or local news   Blog   Twitter   Instagram   None of the above Answer: Blog 3.) FTP stands for   Food Transfer Programme   File Transfer Protocol   File Transfer Programming   Facebook To Python Answer: File Transfer Protocol 4.) The following enables access to computing resources remotely   FTP   VPN   Blog   Twitter Answer: VPN 5.) The following allows an Internet host Computer to become a terminal of another host on the Internet   TELNET   Google Groups   Microsoft OneDrive   None of the above Answer: TELNET 6.) To which protoc...

Can Chat GPT Predict About Stock Market

Can ChatGPT predict the stock market? To answer this question, it's crucial to understand how ChatGPT operates. Developed by OpenAI, ChatGPT is an advanced artificial intelligence language model capable of comprehending and responding to natural language input. It engages in human-like conversations with users, having been trained on extensive text data using a deep neural network. Primarily used for applications like chatbots, virtual assistants, and customer service interactions, ChatGPT's versatility allows it to understand and respond to a wide array of topics. The model employs a deep learning architecture known as a transformer model, trained on a substantial corpus of text data. This training enables the model to grasp natural language intricacies and the connections between words and phrases. When a user inputs text, ChatGPT processes it through the transformer model, generating a response based on its understanding of the input text. Techniques such as attention mechan...

Security breach at Parliament

New Delhi: Following a significant security breach at Parliament yesterday, four individuals have been taken into police custody for seven days for thorough questioning. Sagar Sharma and D Manoranjan, apprehended within the Lok Sabha, along with Neelam Devi and Amol Shinde, arrested outside Parliament, are now subjects of detailed inquiries by the Delhi Police. The security breach unfolded yesterday afternoon, leading to the arrest of five individuals, two of whom infiltrated the Lok Sabha and discharged dense yellow smoke using concealed canisters. Sagar Sharma from Lucknow and D Manoranjan from Mysuru had illicitly brought in smoke bombs, causing a brief panic within the Parliament. MPs and parliamentary Watch and Ward staff promptly subdued and overpowered the trespassers. The remaining two individuals, lacking visitors' passes, resorted to raising slogans outside Parliament while carrying the smoke bombs. All four individuals have been charged under the stringent anti-terror la...