C program to print 1 to 100 except 60 to 70.


Code : 
#include <stdio.h>
#include <conio.h>
void main() {
int i,n;
for (i=1;i<=100;i++) {

if (i>=60 && i<=70) {
continue;
}
printf("\n%d",i );
}
getch();
}

Output :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100

IDE Used To Test This Code : DEV C++.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Simple Linear Search Programming in JAVA


Code :
package demo;
import java.util.Scanner;
/**
 *
 * @author www.codetheta.com
 */
public class LinearSearch {
    public static void main(String[] args) {
        int array[], elements, elem_search, each_elements, i, flag = 0;
        Scanner in = new Scanner(System.in);
        System.out.println("Enter number of array elements: ");
        elements = in.nextInt();
        array = new int[elements];
        System.out.println("Enter array elements: ");
        for (i=0; i<elements; i++)
            array[i] = in.nextInt();
        
        System.out.println ("Enter element to find: ");
        elem_search = in.nextInt();
        
        for (i=0; i<elements; i++) {
            if (array[i] == elem_search) {
                flag = 1;
                break;
            }
        }
       if (flag == 0) {
           System.out.println("Not Found");
       }
       else {
           System.out.println("Found");
       } 
    }
}

Output :
Enter number of array elements: 
5
Enter array elements: 
4
7
6
2
8
Enter element to find: 
8
Found

IDE Used To Test This Code : NetBeans IDE 8.2

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Linear Search Programming in C++


Code :
#include<iostream>
#include<conio.h>
using namespace std;
int main() {
int array[20], elements, elem_search, each_elements, i, flag = 0;
cout<<"How many elements? : ";
cin>>elements;

cout<<"Enter elements list in the array: ";
for (i=0; i<elements; i++)
cin>>array[i];
cout<<"Enter elements you want to search : ";
cin>>elem_search;

for (i=0; i<elements; i++) {
if (array[i] == elem_search) {
flag = 1;
break;
}
}
if (flag == 0) {
cout<<"Not Found";
}
else {
cout<<"Found";
}
}

Output :
How many elements? : 4
Enter elements list in the array: 
4
2
7
5
Enter elements you want to search : 7
Found

IDE Used To Test This Code : DEV C++

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to know Memory Address of a String using Python?


id() is use to access memory address of an object in Python.

Code :
StringOne = "www.codetheta.com"
print ("Memory address is:" ,id(StringOne))

Output :
Memory address is: 45121072

IDE Used To Test This Code : Python IDLE

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Two String equal or not using Python program


Using predefined value.
Code :
StringOne = 'www.codetheta.com'
StringTwo = 'ww.codetheta.com'
if StringOne == StringTwo:
    print ("Two Strings are Equal")
else:
    print ("Two Strings are not Equal")

Output :
Two Strings are not Equal

Value given in program runtime
Code :
StringOne = input("Enter first string: ")
StringTwo = input("Enter second string: ")
if StringOne == StringTwo:
    print ("Two Strings are Equal")
else:
    print ("Two Strings are not Equal")

Output :
Enter first string: codetheta
Enter second string: codetheta
Two Strings are Equal

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Reverse of a String using Python program


Pre defined value
Code :
String = "www.codetheta.com"
print(''.join(reversed(String)))

Output :
moc.atehtedoc.www

Program execution time string value given.
Code :
String = input("Enter any string: ")
print(''.join(reversed(String)))

Output :
Enter any string: www.codetheta.com
moc.atehtedoc.www

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Calculate Length of a String using Python


Using predefined string
Code :
String = "www.codetheta.com"
print(len(String))

Output :
17

Value given in run time / program execution time.
Code :
Text = input("Enter a string: ")
print(len(Text))

Output :
Enter a string: www.codetheta.com
17

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Factorial of a number using Python Programming


Code : 
num = int(input("Enter any number: "))
fact = 1
for i in range(1,num + 1):
    fact = fact * i
print("Factorial result is: ",fact)

Output :
Enter any number: 8
Factorial result is:  40320

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Calculate Absolute Number using Python program


Code :
Number = int(input("Enter any positive or negative number: "))
if Number < 0:
    Number = (-1) * Number
    print ("Result is: ", Number)
else:
    print ("Result is: ", Number)

Output :
Enter any positive or negative number: -2458
Result is:  2458

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

Program to calculate Prime Number using Python


Code :
Number = int(input("Enter a number to check: "))

if Number > 1:
    for i in range(2,Number):
        if (Number % i) == 0:
            print("Not a prime number.")
            break
    else:
        print("Prime number.")
else:
    print("Not a prime number.")

Output :
Enter a number to check: 57
Not a prime number.

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to Swapping of two variables using Python?


Code:
FirstNumber = int(input("Enter first number: "))
SecondNumber = int(input("Enter second number: "))
Temp = FirstNumber
FirstNumber = SecondNumber
SecondNumber = Temp
print ("After swapping first number is: {}".format(FirstNumber))
print ("After swapping second number is: {}".format(SecondNumber))

Output:
Enter first number: 56
Enter second number: 87
After swapping first number is: 87
After swapping second number is: 56

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to calculate Multiplication Table using Python?


Code :
number = int(input("Enter a number: "))
for i in range(1,11):
    print(number,'X',i,'=',number*i)

Output :
Enter a number: 18
18 X 1 = 18
18 X 2 = 36
18 X 3 = 54
18 X 4 = 72
18 X 5 = 90
18 X 6 = 108
18 X 7 = 126
18 X 8 = 144
18 X 9 = 162
18 X 10 = 180

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.

How to check a number positive or not in Python?


Code: 
num = int(input("Enter a number to check: :"))
if num > 0:
    print("You have entered positive number")
elif num == 0:
    print("You have entered zero(0)")
else:
    print ("You have entered negative number")
               
Output :
Enter a number to check: :-6
You have entered negative number

IDE Used To Test This Code : Python IDLE.

Try this code in your computer for better understanding. Enjoy the code. If you have any Question you can contact us or mail us.We will reply you as soon as possible.