Coursera's Algorithmic toolbox assignment solutions( Sum of Two Digits, Maximum Pairwise Product ) :

Problem 1: Sum of Two Digits

Solution: (in c++)


( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder)

#include <bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
cin>>a>>b;
cout<<a+b;
}

This code is simple. There's no need for any explanation.
 

 

 

 

Problem 2: Maximum Pairwise Product

Solution: (in c++)


( please guys before moving to the solution try it yourself at least 3-4 times , if you really wanna become a good coder)

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long n,i;
    cin>>n;
    long long a[n];
    for(i=0;i<n;i++)
{
cin>>a[i];
}
sort(a,a+n);
cout<<(a[n-1]*a[n-2]);
}

This code is simple. There's no need for any explanation.
 

 

 

Guys , if you have any queries related to a question or need more explanation, comment down below! 

Comments

  1. Real estate studies often involve complex topics like property valuation, market analysis, and investment strategies, which can be challenging to understand. That’s why many students turn to real estate assignment help for accurate guidance and well-structured solutions. It not only helps in meeting deadlines but also improves understanding of practical concepts, making it easier to perform better academically.

    ReplyDelete

Post a Comment

Popular posts from this blog

HackerEarth's basic programming solutions( Ali and Helping innocent people, Duration, Book of Potion making ) :

HackerEarth's basic programming solutions( Life the Universe and Everything, Ladderophilia, Char Sum ) :