Introduction to Java

November 24, 2019

               What is Java?                     
,

                         Java is the most broadly utilized programming language. It creates a secured, reliable and platform independent programming language. Which should be imperative and reflective.



Highlights of java


1              1.  Simple, Small and Familiar:

Java is simple because most of the features are derived from c and cpp. Java removes complexity because it does not uses the pointers.

Java is definitely not small but it is small in terms of coding and programming statements.


2             2.  Object Oriented Language:       

A programing language which supports the features like polymorphism, inheritance, Data hiding, Data abstraction, Encapsulation is called as an object oriented language.

3             3.  High performance:

Java programs are compiles to a portable intermediate code through a user defined class known as byte code. Because of this Java’s reusability is maximum and its execution speed is comparable with its native c and cpp. Java compiler convert the java code in o byte code and these byte code is executed by JVM (Java Virtual Machine) hence java programs and applications provide high performance on every platform.


4             4.  Platform Independent:

Java program written on one platform and can run on any other platform without need to recompile or any modifications.
  

5            5.  Multi-Threaded:

Multithreading means threading multiple threads at a time. Threads are used in network based applications.


6            6.  Interpreted and Compiled:

Java programs are compiles to a portable intermediate code through a user defined class known as byte code. Because of this Java’s reusability is maximum and its execution speed is comparable with its native c and cpp. Java compiler convert the java code in o byte code and these byte code is executed by JVM (Java Virtual Machine) hence java programs and applications provide high performance on every platform.


7            7.  Robust and secure (Easily executable):

Java is widely used in web servers and web pages. The ability to create the robust programs was gives a high priority during design a java. It performs compile time as well as runtime checking for datatype. Java is design with built-in tools called garbage collector, which reduces all the memory management problems for the programmers.


8             8.  Portability:

Java perform the portability because of its architecture neutrality. Source code may run on different hardware platforms to platform. This consistencies make the java platform portable on different platforms such as Windows, Unix, etc.        

                             So in next blog We see the exact coding of Java Programming.






Introduction to Java Introduction to Java Reviewed by Amit Waghmare on November 24, 2019 Rating: 5

Palindrome Number

November 23, 2019

                            


                                     First, we see what is Palindrome number. If we are giving input as 4567 then program separates every integer no and rearrange it in a reverse manner and again see the original number is the same or not, the i.e. original number is 4567and reversed number is 7654 and it is not equal so the output is not palindrome. But if input is 12321 then the original number and reversed number is equal. So the output is Palindrome number. We see the demo of this code as follows:

Python code for Palindrome Number:
def Palindrome(Number):
        n=Number
        Reverse=0
        while n>0:
            Reminder=n%10
            Reverse=(Reverse*10)+Reminder
            n=n//10
        if(Number==Reverse):
                print(Number,'is a palindrome number')
        else:
                print(Number,'is not a palindrome number')
num=int(input("Enter a number: "))

Palindrome(num)

Output:
Enter a number: 12321
12321 is not an Armstrong number

Enter a number: 1245

1245 is not a palindrome number
Palindrome Number Palindrome Number Reviewed by Amit Waghmare on November 23, 2019 Rating: 5

Armstrong Number

November 23, 2019


                      
                      An Armstrong number is a digit is an integer such that the sum of the cubes of its digits is equal to the number itself. For example, 370 is an Armstrong number since 3**3 + 7**3 + 0**3 = 370.
           To write a code in python we use logic to separate the integer number from the given number. Use modulo (%) to separate the integers, then we use the sum variable to add and calculate the cube of the appropriate number and so on.


Python code For Armstrong Number:
def Armstrong_no(x):
 no=x
 sum=0
 while no>0:
    R=no%10
    sum=sum+(R*R*R)
    no=no//10
 if num==sum:
    print(num,"is an Armstrong number")
 else:
    print(num,"is not an Armstrong number")
   

num=int(input("Enter a number: "))
Armstrong_no(num)

Output:
Enter a number: 370
370 is an Armstrong number

Enter a number: 457
457 is not an Armstrong number
Armstrong Number Armstrong Number Reviewed by Amit Waghmare on November 23, 2019 Rating: 5

Python program to reverse the given integer number

November 14, 2019


https://ccpptutoriallands.blogspot.com/2019/11/python-program-to-reverse-given-integer.html

                        In this post we see the python code to reverse the given number. we see what is Reverse number. If we are giving input as 1854 the program separates each and every integer no and rearrange it in a reverse manner and the result is 4581.

Program:

def reverse(Number):
    Reverse= 0
    while(Number > 0):
        Reminder = Number %10
        Reverse = (Reverse *10) + Reminder
        Number = Number //10
    print("\n Reverse of entered number is = %d" %Reverse)
Number = int(input("Please Enter any Number: "))
print(reverse(Number))

Output:

Please Enter any Number: 14897
Reverse of entered number is = 79841

The logic for this code is same like c and c++ language. So I'm not giving the explanation for this code. If you want explanation then write in comment box.
Python program to reverse the given integer number Python program to reverse the given integer number Reviewed by Amit Waghmare on November 14, 2019 Rating: 5

Python program to generate Fibonacci series

November 11, 2019



Fibonacci Series

                         Hello friends, In this post we see the python code to generate Fibonacci series. Fibonacci series means if we are giving input as 7 then the output is 0  1  1  2  3  5.
                        Means in output first digit is 0 then second is 1,addition of first and second digit is third digit i.e.0+1=1,next is 1+1=2,then 2+1=3,then 3+2=5. The next digit is 5+3=8 but 8 is greater than 7(8>7) i.e.(8!<7) so the control is transfer to the out of the loop. The actual code is as follows:
Program:

n=int(input('Enter the number:'))
a=0
b=1
c=a+b
print("fibonacci series is :")
while(c<=n):
      print(c)
      a=b
      b=c
      c=a+b

Output:
Enter the number:48
Fibonacci series is :
1
2
3
5
8
13
21
34
>>>










Python program to generate Fibonacci series Python program to generate Fibonacci series Reviewed by Amit Waghmare on November 11, 2019 Rating: 5

Given number is even or odd

November 09, 2019



Check the given number is even or odd

                     Hello, In this post we see the python code to check the given number is even or odd.

Program:
num=int(input("enter the number to find even or odd....?\n"))
if (num%2)==0:
    print("the number is even")
else:
    print("the number is odd")

                    In above code, under if condition the print statement is written and i.e. important. In python this is known as indentation. If we create or write any condition or loop then that loop or condition related all the statements is under that condition and this is python rule. The output is like,

Output:
enter the number to find even or odd....?
78
the number is even

>>> 

enter the number to find even or odd....?
77
the number is odd
>>>




Given number is even or odd Given number is even or odd Reviewed by Amit Waghmare on November 09, 2019 Rating: 5

Python program to show when you are 100 yrs old

November 07, 2019

               
                   Hello. In this post, we see the program of python program that asks the user to enter their name and their age and it prints out a message addressed to them that tells them the year that they will turn 100 years old. This is a very simple and compact code, to assign in python features.

Program:

name=input("What is your name:")
age=int(input("How old are you:"))
year=str((2017-age)+100)
print( name, "You will be 100 years old in the year", year)

Explanation:
                  This is the second code for us to write and run the code in python. I explain this code because this code is a little bit complicated. I explain this code line by line, so let's start ...

1.name=input("What is your name:")
In this line, we use the "input" keyword to get input from the user i.e. user name and stored into the "name" variable. The string which is used in the double quote is instruction for the user.

2.age=int(input("How old are you:"))
In the first line, we did not use any datatype line int or float or char but in this line, we use int datatype to accept integer value as age from the user and store this age into the variable age.

3.year=str((2017-age)+100)
To display the year, when the user is 100 years old. Here we forcefully convert int datatype into string datatype. So we use str. year=((2017-age)+100) this is correct as per condition but not per logic, so we use year=str((2017-age)+100).

4.print( name, "You will be 100 years old in the year", year)
This is a simple print statement to print a message with name and year. To display the message we use a double or single quote and to display the value which is stored in the variable and assign variable in print statement we did not use double or single quote. The output is like,

Output:

What is your name: Amit
How old are you:19
Amit You will be 100 years old in the year 2098
If you have any doubt then write it in a comment.


Python program to show when you are 100 yrs old Python program to show when you are 100 yrs old Reviewed by Amit Waghmare on November 07, 2019 Rating: 5

Consonant and Vowels

November 05, 2019




Count Consonant and Vowels

            Hello friends, here we are seeing the cpp program for the count the number of the vowel and consonant in the given string. We know a, e, i, o, u are five vowels. But how we check how many times the vowels and consonant have come in the sentence. So by using the following cpp program we easily count the number of vowels and consonant and blank spaces and also the digits in the given string.


Cpp language code for count the consonant and vowel:
#include <iostream.h>
//using namespace std;

int main()
{
    char line[150];
    int vowels, consonants, digits, spaces;

    vowels =  consonants = digits = spaces = 0;
    cout << "Enter a line of string: ";
    cin.getline(line, 150);
    for(int i = 0; line[i]!='\0'; ++i)
    {
 if(line[i]=='a' || line[i]=='e' || line[i]=='i' ||
    line[i]=='o' || line[i]=='u' || line[i]=='A' ||
    line[i]=='E' || line[i]=='I' || line[i]=='O' ||
    line[i]=='U')
 {
     ++vowels;
 }
 else if((line[i]>='a'&& line[i]<='z') || (line[i]>='A'&& line[i]<='Z'))
 {
     ++consonants;
 }
 else if(line[i]>='0' && line[i]<='9')
 {
     ++digits;
 }
 else if (line[i]==' ')
 {
     ++spaces;
 }
    }

    cout << "Vowels: " << vowels << endl;
    cout << "Consonants: " << consonants << endl;
    cout << "Digits: " << digits << endl;
    cout << "White spaces: " << spaces << endl;

    return 0;
}


Output:




Consonant and Vowels Consonant and Vowels Reviewed by Amit Waghmare on November 05, 2019 Rating: 5

Area of circle in Cpp language

November 02, 2019




Cpp program for area of circle

          Hello friends, in this blog we see the cpp program for finding the area of the circle. To find the area of the circle we must know the formula for calculating the area of circle i.e. area = pi * radius * radius
          In this formula, the value of pi is in float i.e. 3.14, so we are using float datatype. By using the following program we find the area of the circle.

C language code for Area of Circle:
#include<iostream.h>
#include<conio.h>

void main()
{
   float radius, area;/* to accept floating number*/

   cout<<"\nEnter the radius of Circle : ";
           //take input from the user

   cin>>radius;
      /* to store the floating number,
       
   area = 3.14 * radius * radius;
    // formula and answer store in area variable

   cout<<"\nArea of Circle :"<<area;  // display answer
   getch();
}
_____________________________________________________________
Output:
Enter the radius of Circle:3
Area of Circle:28.26

Enter the radius of Circle:9.54
Area of Circle: 285.776424





Area of circle in Cpp language Area of circle in Cpp language Reviewed by Amit Waghmare on November 02, 2019 Rating: 5

Volume of cylinder in Cpp language

November 02, 2019

C program for volume of Cylinder

          Hello friends, in this blog we see the cpp program for finding the Volume of cylinder. To find the volume of a cylinder we must know the formula for calculating the area of cylinder i.e. vol = pie * r * r * h.
In this formula the value of is in float i.e. 3.14, so we are using float datatype. By using the following program, we find the area of the cylinder.

C language code for Volume of cylinder:
#include<iostream.h>
#include<conio.h>

void main()
{
    float vol,pie=3.14;

    float r,h;

    clrscr();

    cout<<"ENTER THE VALUE OF RADIUS:";

    cin>>r;

    cout>>"ENTER THE VALUE OF HEIGHT:";

    cin>>h;

    vol = pie * r * r * h;

    cin>>"VOLUME OF CYLINDER IS : "<<vol;

    getch();

}
Output:­
ENTER THE VALUE OF RADIUS: 7
ENTER THE VALUE OF HEIGHT :3
VOLUME OF CYLINDER IS: 461.58

ENTER THE VALUE OF RADIUS: 4.6
ENTER THE VALUE OF HEIGHT: 6.8
VOLUME OF CYLINDER IS: 451.80832




Volume of cylinder in Cpp language Volume of cylinder in Cpp language Reviewed by Amit Waghmare on November 02, 2019 Rating: 5