Friday, 8 December 2017

Addition Program In C


c addition program is a very basic program in c. addition program in c refers to an addition of  numbers. in this program user will enter any two number of their choice and program returns sum of that two numbers as output.


C Addition Program


#include<stdio.h>
#include<conio.h>
Void main()
{
int num1,num2;          
int sum;
printf(“Enter First Number:”);
scanf(“%d”,&num1);
printf(“Enter Second Number:”);
sum=num1+num2;
printf(“Addition Of Entered Two Numbers Is:%d”,sum);
getch();
}

Output:

Enter First Number:10

Enter Second Number:20

Addition Of Entered Two Numbers Is:30

Explanation:

In above program

#include<stdio.h>
#include<conio.h>

In first two lines contains the header files. Header files are nothing but the  libraries of c programming. 

Inbuilt functions and features which are we using in program such as printf(),scanf(),getch() etc are defined in these header files.

 If you doesn’t include these header files write program you got error messages. These function cant work without including header files.

void main() :

 this is the main function of c programming. Program execution starts from here. Void is the return type of main function. 

It may be change such int main(), void return type means it doesn’t return anything so void is defined as return type of main ().

int num1,num2: 

int this line we declare two variables of int type num1 and num2 respectively. These two variable accepts integer numbers in run time user enters.

int sum:

In this line we declare sum variable of int type to store the addition of above two variables num1 and num2. The variables num1 and num2 are type of int so that their addition also of int type so we declare sum variable as int type.

printf():

printf() will print the message on the screen which is mentioned int the double inverted quo ma in brackets.

Scanf():

scanf() function is used to store data in variables at  run time. It accepts value from user at run time. If users enter valid value same as data type it accept it and store in that particular variable.

Sum=num1+num2:

In this line program performs addition of num1 and num2 variables and it assign it to the variable sum.

Getch():

This function hold the screen. This function is defined in  #include<conio.h>


Wednesday, 6 December 2017

Variables In C

Variables In C

In simple words we can say that c variable is nothing but the name given to the memory location in which we can store data for the manipulations. Every c variable has a specific data type which determines what type of data is to be stored in specific variable and what should be a range of it.
  c variables value may be change during the program execution. Variables in c belongs to the any data type such as int,float,char,double etc.

Rules for declaration of variables

1.     Variable name must begin with letter or underscore.
2.     Variable name is case sensitive.
3.     We can use any numbers and letters in variable name.
4.      Special symbols are not allowed escape underscore (_) in variable name.

Defining variable:

Variable definition means the allocation of memory for the variable. Before using the variable it should be defined. So the system assigns the memory for that specific variable according to the data type of variable.

Syntax:

[
Data Type  var_name1,var_name2….var_nameN;

Data type- it refers to data type of variable such as int,char,float etc.
var_name1,var_name2….var_nameN- refers to an variable list. We can declare any number of variables.
Example:
int a,b;
char ch;
float n;
]

Assigning values to variables:

Assign values to the variables means storing data into the reserved memory location by the variables. Variables can be assigned at the time of definition and in the program also.

Assigning variable at the time of definition

[

int a=10;
char ch=’a’;
]

Assigning value in the program

[

#include<stdio.h>
int main()
{
int a,b,c;    //defining variabe
a=10;          //assigning value 10 to variable a
b=20;       //assigning value 20 to variable b
c=a+b;        //assigning addition of variable a and b to the c
printf(“Addition of a and b is:%d”,c);
return 0;
}
]

What is the lvalue and rvalue?

Generally we listen about rvalue and lvalue in programming, many of those can’t understand what is actual what is rvalue and lvalue.
Lvalue: lvalue always refers to a memory location. It points to memory address. It may be on left hand side and right and side also. Variables are comes into this categories.
Rvalue: rvalue always refers to numeric values. It always present on right hand side but not left hand side. Rvalues always assigns to variables. Values cant be assign to rvalues.

[ A       =      10
Lvalue   rvalue
]



Sunday, 3 December 2017

Data Types In C

Data Types In C
C data types are used to determine  which type of value is to be stored in the variable (memory block) and it also determines the return type of the functions. C programming is  very rich In data types.
C programming provides different types of data types to store the values in variables. c data types are given below –

Basic Data Types

Int
Float
double
Char
void

Derived Data Types

Array
Pointer
Structure


Basic data types

Integer

integer type can store whole numbers including positive and negative numbers. Int keyword is used to declare integer type.

For example:

int a=20;
int a,b;

 Floating type

Floating types can store the real numbers.real number means number having floating point up to one precision. Float keyword is used to declare floating type.

For example

float a=10.5

Double type

Double type stores the real numbers which having double precision. Double keyword is used to declare double type.

For example:

double a=255.30;


 Character type

Character types can be store single character. Char keyword used to declare character type.

For example:

char a=’c’;
char b=’5’;

Void type

Void type stores nothing. Void means nothing. Void is usually used to declare the return type of function which doesn’t return any value.

Modifying the Basic Types

 basic data types have various modifiers preceding them. A type modifier helps base type to more precisely fit a specific need.
The list of modifiers are:

 Signed
 Unsigned
 Long
 short

The int base type can be modified by as short, long, signed and unsigned and long  can be modified as double. The char type can be modified as unsigned and signed.

following table shows the data type its size and range.
Data type
size
Range
char
8
–127 to 127
unsigned char
8
0 to 255
signed char
8
–127 to 127
int
16/32
–32,767 to 32,767
unsigned int
16/32
0 to 65,535
signed int
16/32
–32,767 to 32,767
short int
16
–32,767 to 32,767
unsigned short int
16
0 to 65,535
signed short int
16
–32,767 to 32,767
long int
32
                     –2,147,483,647 to 2,147,483,647
long long int
64
– (263 – 1) to 263 – 1 (Added by C99)
unsigned long int
32
0 to 4,294,967,295
signed long int
32
–2,147,483,647 to 2,147,483,647
float
32
1E–37 to 1E+37 with six digits of precision
 double
64
1E–37 to 1E+37 with ten digits of precision
long double
80
1E–37 to 1E+37 with ten digits of precision






Derived data types

Array

Array is nothing but the collection of the same data types values.

Pointer

Pointer points the other memory location.

Structure

Structure is the collection of different data types.


  

Saturday, 2 December 2017

How to Speed up Windows 10

How to Optimize/Speed up Windows 7,8,10 performance. Windows 10 are slow working so don’t worry!
speed-up-windows-10

Firstly I will tell you some application that will improved speed of operating system then some tips are provide to improve speed of operating system.

How to Speed up Windows 10

1. Use C Cleaner

C Cleaner is very popular application that will remove temporary files and cookies, history of any browsers. C cleaner remove Firefox, Chrome, Opera or Internet Explorer temporary files.
Use c cleaner

First up all download & install c cleaner.
After installation of c cleaner start the c cleaner and click on the Run cleaner button wait until it will finish its work and that sit.

 2.   Disk Cleanup

Disk cleanup can delete temporary internet files, old downloaded program files, empty the recycle bin.
Perform disk cleanup for every Month or 15 days. This tool is built in windows operating system
I am now talking about windows 7.
Disk cleanup

Go to Start -> All programs ->Accessories -> System tools ->Disk cleanup
Or Start -> Run-> type cleanmgr
Then select drive then press ok wait until the process will finish and then choose which files we want to delete.

 3. Uninstall unnecessary programs
Go to your Control Panel then uninstall the unnecessary program that we    don’t use regularly. It will be also useful to improve speed of your operating system.

4. Disable the windows start up programs

The programs that will see in the notification areas that will be a startup program all this program you don’t need of them you want to disable them
As follow:

Press Windows+R and then type their ‘msconfig’ then new window will be open then select the tab startup and unselect the program that we don’t need at startup. Due to this your operating system will be boot fast.

5. Use Antivirus Software
Use the antivirus software that will be remove malwares, viruses on your computer system hence your operating system work smoothly.

Malwarebytes Anti-Malware is free. Use this anti-malware protection to remove malware.

6. Add more RAM:
Even if your computer is running slow then you need to install more RAM in your computer.

I hope this post will be helpful to you if you have any query regarding this comment below.

Sunday, 26 November 2017

How to install Java on Windows Operating System?



In earlier post we learn about Java Virtual Machine (JVM), JVM is interpreter for bytecode in simple words JVM helps to run java programs in your system. To setup this JVM you need to install Java Development Kit also known as Java JDK which is free from Oracle.



To install this Java Development Kit follow the next steps –

Step 1: Downloading the Java Development Kit (JDK)


Open your favorite web browser and search for Java JDK Oracle you will find the link www.oracle.com just open it.


Step 2: Java SE Downloads

Click on the Download button of JDK installation file.

(Optional: If you want to download an IDE for java then click on Download button of NetBeans)


Step 3: Select the installation file for your system

To download the JDK installation file you need to Accept License Agreement by clicking radio button and then click the link next to your Operating System.

Click on “Yes” button to proceed next step

Step 4: Open the Downloaded JDK Executable file

After downloading task is completed go to downloads location and choose the downloaded file and just double-click on the installer file.
Then Click “Yes” button to allow JDK installation in your system

You will appear the welcome screen of installer Click “Next” button to proceed
Then click “Next” button to accept the default installation (otherwise you can change the location of JDK installation files.) 

it takes few minutes to install, after the installation process is completed click on “Close” button.


Step 5: set PATH and JAVA_HOME environment variables.
Installation process is completed but we need to set PATH and JAVA_HOME environment variables to run java programs successfully.
A. copy the address of bin folder / directory of jdk
Go to location where you installed Java (which you selected in step 5) and then open jdk folder/directory then bin folder/directory and copy the directory address

b. Open System Properties and Select Advance System Settings
To Open System Properties just Right-Click start icon and select System option
Or Click Win + X key and the click “Y”
Click on Advanced System Settings.

C. Click on “Environment Variables” button to edit variables

Then click on “New” button of User Variables of your pc and insert JAVA_HOME as name of variable and insert path of bin folder as variable value.
Click “Ok”.


Select the Path variable from System Variables and click on “Edit” button ( or just double-click on Path variable )
You need to paste the address of bin folder of JDK and click OK button.
Remember that paste the address of bin folder after semicolon ( ; ) of earlier variable value.


Step 7: Installation and Setup process is completed
All process is completed its time to check installation
Just go to command prompt and hit the “java –version” command if it shows the version of java jdk then congratulation you have successfully installed java on your system.
If you have any problems in the installation process just comment below, we will solve your problem definitely.
Thank You!