// Q.1 Print all even number from 100..
for (let i = 0; i<=100; i++) {
// console.log(i);
if (i % 2 == 0) {
console.log(i);
}
}
👍1
// Q.2 Guessing Correct number by user in loop..
let userInput = prompt("Enter Your Guessed Number: ");
while (userInput != 87) {
userInput = prompt("Enter Your Guessed Number: ");
}
console.log("You Guessed Correct Number 87..");
// Print Fibonacci Series
#include <stdio.h>
int main() {
int i, userInput, fibo, firstNum = 0, secondNum = 1;
printf("Enter a number count to print Fibonacci Series: ");
scanf("%d", &userInput);
for (i=0; i<userInput; i++) {
fibo = firstNum;
firstNum = secondNum + fibo;
secondNum = fibo;
printf("%d\n", fibo);
}
return 0;
}
// Infinite loop in C
// Note:- Don't try for long intervel of time ....
#include <stdio.h>
int main() {
for( int i = 0; ; i++ ) {
printf("%d", i);
}
return 0;
}
Master HTML/CSS for Free!
1. W3Schools - w3schools.com
2. Javatpoint - javatpoint.com/html-tutorial
3. Html - html.com
4. Geeksforgeeks - geeksforgeeks.org/html
5. Developer Mozilla - https://developer.mozilla.org/en-US/
1. W3Schools - w3schools.com
2. Javatpoint - javatpoint.com/html-tutorial
3. Html - html.com
4. Geeksforgeeks - geeksforgeeks.org/html
5. Developer Mozilla - https://developer.mozilla.org/en-US/
# Easy method to find largest number from 4 nuumbers
def largestNum(a, b, c, d):
if a>b:
if a>c:
if a>d:
print(a)
else:
print(d)
else:
if c>d:
print(c)
else:
print(d)
else:
if b>c:
if b>d:
print(b)
else:
print(d)
else:
if c>d:
print(c)
else:
print(d)
x = int(input(""))
y = int(input(""))
z = int(input(""))
m = int(input(""))
fine = largestNum(x, y, z, m)
print(fine)
🔥1
// Print Fibonacci series
import java.util.Scanner;
public class FibonacchiSeries {
public static void main(String[] arg) {
Scanner userInput = new Scanner(System.in);
System.out.print("Enter a number: ");
int num = userInput.nextInt();
int fibbo, firstNum = 0, secondNum = 1;
for(int i=0; i<num; i++) {
fibbo = firstNum;
firstNum = secondNum + fibbo;
secondNum = fibbo;
System.out.println(fibbo);
}
}
}
# Finding factorial using Recursion...
def factorial(n):
if n==0:
return 1
else:
return n*factorial(n-1)
num = int(input("Enter a number: "))
print(factorial(num))
## Armstrong number finder.....
num = input("Enter a number: ")
length = len(num)
summ = 0
for i in range(length):
summ += int(num[i]) ** length
print(summ)
Identifying..
if summ == int(num):
print(f"{num} is an Armstrong Number.")
else:
print(f"{num} is not an Armstrong Number.")
# Question:
# Write a program which will find all such numbers which are divisible by 7
# but are not a multiple of 5, between 2000 and 3200 (both included).
# The numbers obtained should be printed in a comma-separated sequence on a single line.
# i = 2000
list1 = []
for i in range(2000, 3200):
if i%7 == 0:
if i%5 != 0:
list1.append(i)
print(list1)