Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class projluca
- {
- static void Main()
- {
- Random r = new Random();
- int nbA = 0;
- int m = 0;
- int nbB = 0;
- int nbC = 0;
- double res = 0;
- Console.WriteLine("A=5 B=2 C=0.1");
- while (res!=100)
- {
- nbA = r.Next(1, 99);
- m = 100 - nbA;
- nbB = r.Next(1, m + 1);
- nbC = 100 - nbB - nbA;
- res = acc(nbA, nbB, nbC);
- if(res==100)
- {
- Console.WriteLine("Il y a " + nbA + " A");
- Console.WriteLine("Il y a " + nbB + " B");
- Console.WriteLine("Il y a " + nbC + " C");
- }
- }
- }
- public static double acc(int r, int s, int t)
- {
- double a = 5;
- double b = 2;
- double c = 0.1;
- double f = 0;
- f = r * a + s * b + t * c;
- return f;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement