Tag

# c# Archives - Mir Imad Ahmed

Hello Everyone !!

I have been receiving a lot of requests to make a tutorial on how to download asset bundle from server in Unity 3D. Here I made a simple video tutorial for you guys to learn how you can download asset bundle from server under 2 minutes.

Asset bundles are a great way to maintain and expand your game. In this video I show you how to set up asset bundles and use them in an online Unity game or application. I have also written about making and exporting asset bundles here.

Downloading asset bundle from server is as easy as shown. In under 2 minutes you will see how I downloaded asset bundles from server using simple Unity 3D and C# code.

```using UnityEngine;
using UnityEngine.Networking;
using System.Collections;

public class MyBehaviour : MonoBehaviour {
void Start() {
StartCoroutine(GetAssetBundle());
}

IEnumerator GetAssetBundle() {
UnityWebRequest www = UnityWebRequest.GetAssetBundle("http://www.my-server.com/myData.unity3d");
yield return www.SendWebRequest();

if(www.isNetworkError || www.isHttpError) {
Debug.Log(www.error);
}
else {
}
}
}```

Watch my All unity tutorials.

Do you need “Project Euler Problem 9 Solution c sharp” . We will discuss all the problems in Project Euler and try to solve them using Python or C#. I have solved Project Euler Problem 8 JS as well.

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which,

a^2 + b^2 = c^2
For example, 32 + 42 = 9 + 16 = 25 = 52.

There exists exactly one Pythagorean triplet for which a + b + c = 1000.
Find the product abc.

So we have to solve this problem using C#.

Lets first of all open Visual Code.

If we analyze the problem statement given here, we can see that we are asked to find the pythagorean py triplet number.

## Project Euler Problem 9 Solution C Sharp|

### Lets start!

```using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;

namespace Rextester
{
public class Program
{
public static void Main(string[] args)
{
Console.WriteLine("Hello, world!");
for(int a = 1; a < 998; a++)
for (int b = a + 1; b < 998; b++)
for( int c = b + 1; c < 998; c++)
if (isPyTriple(a,b,c))
if(a + b + c == 1000)
{
Console.WriteLine(a);
Console.WriteLine(b);
Console.WriteLine(c);
Console.WriteLine(a*b*c);
}

}

static bool isPyTriple(int a, int b,int c){
return (a * a) + (b * b) == (c * c);
}
}
}```

For such type of problems the first thing that hit my mind was Brute Force! Obviously!

I put a for loop inside a for loop which is also inside a for loop so that we can brute force the three numbers a, b and c.

Then I made a special function to return a boolean by checking the mere condition of PyTriplet.

I checked for each element by brute force and got my answer right there and then.

Yaay! We got this right. Thanks for reading.

Project Euler Problem 10 Solution C#

Happy coding!