hackerEarth questions Siemens
#include<stdio.h>
int main()
{
int c[ ]={2.8,3.4,4,6.7,5};
int j, *q=c;
for(j=0;j<5;j++)
{
printf("%d ",*c);
++q;
}
return 0;
}
3.7
11
class company1:
cars_manuf = 100
def x(self):
company1.cars_manuf = 150
class company2(company1):
cars_manuf = 1000
def x(self):
print(company2.cars_manuf*company1.cars_manuf)
class company3(company1):
def x(self):
cars_manuf = 10
class Partner(company2, company3):
def x(self):
partner_car_val = company2.cars_manuf/company3.cars_manuf
return partner_car_val
obj = Partner()
a = obj.x()
print(a)
Thank you!
11
0
3.75
4
struct Semaphore
{
enum value(0, 1);
Queue q;
}
P(Semaphore s)
{
if (s.value == 1)
{
s.value = 0;
}
else
{
q.push(P);
sleep();
}
}
V(Semaphore s)
{
if (s.q is empty)
{
s.value = 1;
}
else
{
q.pop();
wakeup();
}
}
Thank you!
4
0
Are there any code examples left?
New code examples in category C++
-
C++ 2023-04-28 17:44:25
-
C++ 2022-03-27 19:20:39 lists occurrences of characters in the string c++
-
C++ 2022-03-27 18:00:14 variabili in c++
-
C++ 2022-03-27 17:10:08 repeat character n times c++
-
C++ 2022-03-27 15:50:07 delete an array c++
-
C++ 2022-03-27 15:40:12 C++ pointer to base class
-
C++ 2022-03-27 12:15:21 find the graph is minimal spanig tree or not
-
C++ 2022-03-27 11:30:15 multi variable assignment cpp
-
C++ 2022-03-27 11:05:17 c++ pi float
-
C++ 2022-03-27 10:20:12 why exceptions can lead to memory leaks