Code:
from ctypes import *
class HELLO(Structure):
_fields_=[("a",c_int),
("b",c_int)]
x=input()
y=input()
hai=HELLO(x, y)
print hai.a,hai.b
from ctypes import *
class HELLO(Structure):
_fields_=[("a",c_int),
("b",c_int)]
x=input()
y=input()
hai=HELLO(x, y)
print hai.a,hai.b
from ctypes import *
class HELLO(Structure):
_fields_=[("a",c_int),
("b",c_int)]
x=input()
y=input()
hai=HELLO(x, y)
print hai.a,hai.b
#include <Python.h>
int fact(int n)
{
if ((n == 0)||(n==1))
return 1;
else
return fact(n*fact(n-1));
}
static PyObject* fact(PyObject* self, PyObject* args)
{
const char *command;
int n;
if (!PyArg_ParseTuple(args, "i", &n))
return NULL;
return Py_BuildValue("i", fact(n));
}
static PyMethodDef FactMethods[] = {
{"fact", fact, METH_VARARGS, "Calculate the Factorial of given numbers."},
{NULL, NULL, 0, NULL}
};
PyMODINIT_FUNC
initfact(void)
{
(void) Py_InitModule("fact", FactMethods);
}
#include <Python.h>
int fact(int n)
{
if ((n == 0)||(n==1))
return 1;
else
return fact(n*fact(n-1));
}
static PyObject* fact(PyObject* self, PyObject* args)
{
const char *command;
int n;
if (!PyArg_ParseTuple(args, "i", &n))
return NULL;
return Py_BuildValue("i", fact(n));
}
static PyMethodDef FactMethods[] = {
{"fact", fact, METH_VARARGS, "Calculate the Factorial of given numbers."},
{NULL, NULL, 0, NULL}
};
PyMODINIT_FUNC
initfact(void)
{
(void) Py_InitModule("fact", FactMethods);
}
Comment