Home

Learn Programming & Prepare for NPTEL Exams... Swayam Solver is your one-stop destination for NPTEL exam preparation.

An Introduction to Programming through C++ | Week 2 : Assignment 2 | Jan 2022 | NPTEL

 Programming Assignment Code :-


Programming Assignment 2.1

Due on 2022-02-10, 23:59 IST



~~~THERE IS SOME INVISIBLE CODE HERE~~~

main_program{
  
  int N,m,n;
  cin>>N;
  int sum=0, carry=0;
  repeat(N)
  {
    cin>>m>>n;
    sum=(m+n+carry)%10;
    cout<<sum;
    carry=(m+n+carry)/10;
    cout<<endl;
  }
  cout<<carry<<endl;
}


--------------------------------------------------------------------------------------

Programming Assignment 2.2

Due on 2022-02-10, 23:59 IST



~~~THERE IS SOME INVISIBLE CODE HERE~~~


main_program{
  
  int N,m,n;
  cin>>N;
  int sum=0;
  repeat(N)
  {
    cin>>m>>n;
    sum+=m*n;
  }
  cout<<sum<<endl;
}

---------------------------------------------------------------------------------------

No comments:

Post a Comment

Keep your comments reader friendly. Be civil and respectful. No self-promotion or spam. Stick to the topic. Questions welcome.