Programming Contest 3

in #contest7 years ago

Introduction to contest

This contest is to just brainstorm or practice your programming knowledge. The prize is not much but a suitable answer will definitely get the prize.

Rules

  • Comment your answer
  • Upvote this post
  • Resteem ( optional)

Question
Find the value of z in x+4y+3z=0 where x and y should be entered by the user.

The programming language to use

  • Python/C/C++

Prize

0.5 sbd and upvote in a comment from my account.

Note: If there is more than one winner in the comment section then all the correct answer will be assigned a number from 1 to n and using programming script of python one number will be generated and is declared as winner, pretty like programming luck draw

Also, Resteem this post and get 0.05 SBD from me if you have more than 1000 followers and 0.01 for less than 1000 followers.

Just post your profile link with which you resteemed and write resteemed

Example: Resteemed - your link

The contest will be organized frequently.

Follow @programminghub for more

Thank You

Sort:  

@ah101 and @clevershovel congrats you guys share 0.5 sbd. congrats.

Ohhh, ohh. Interesting problem. Gonna solve it once I get home.

Here's my solution in python:

def solveProblem(x, y):
    x *= -1
    y *= 4
    return (x - y)  / 3

xVariable = input("Please type in the value of x: ")
yVariable = input("Please type in the value of y: ")
xVar = int(xVariable)
yVar = int(yVariable)
print ("The result is: %f" % (solveProblem(xVar, yVar)))
#include <iostream>
#include <iomanip>

using namespace std;

int main()
{
 double x, y;
 cin >> x >> y;
 double z = (-x - 4*y)/3
 cout << fixed << setprecision(5) << z;
 return 0;
}