Professional Documents
Culture Documents
#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
return 0;
}
Output
Enter an integer: -7
-7 is odd.
#include <stdio.h>
int main() {
int num;
printf("Enter an integer: ");
scanf("%d", &num);
Output
Enter an integer: 33
33 is odd.
q.2)Program-1
for i in range(2,11):
print((1/i),end=" ")
Output
0.5 0.3333333333333333 0.25 0.2 0.16666666666666666
0.14285714285714285 0.125 0.1111111111111111 0.1
Program-2
a=[]
for i in range(2,11):
a.append(1/i)
print(a)
Output
[0.5, 0.3333333333333333, 0.25, 0.2, 0.16666666666666666,
0.14285714285714285, 0.125, 0.1111111111111111, 0.1]
#include <stdio.h>
int main() {
int n, rev = 0, remainder;
printf("Enter an integer: ");
scanf("%d", &n);
while (n != 0) {
remainder = n % 10;
rev = rev * 10 + remainder;
n /= 10;
}
printf("Reversed number = %d", rev);
return 0;
}
Output
Output
# input age
age = int(input("Enter Age : "))
Output
Enter Age : 19
You are Eligible for Vote.
year = int(input("Enter Year:"))
if year % 4 == 0:
if year % 100 == 0:
if year % 400 == 0:
print("Yes, {} is Leap Year".format(year))
else:
print("No, {} is Leap Year".format(year))
else:
print("No, {} is Leap Year".format(year))
else:
print("No, {} is Leap Year".format(year))
Enter Year:2000
Yes, 2000 is Leap Year