Algorithms and Flowchart in C Programming

Posted by Tushar Bedekar
                              

                                           Algorithms:-
A sequential solution of any program that written in human language,called algorithm.
Algorithm is first step of the solution process, after the analysis of problem, programmer write the algorithm of that problem.
Example of Algorithms:
Q. Write a algorithms to find out number is odd or even?
Ans. 
step 1 : start
step 2 : input number
step 3 : rem=number mod 2
step 4 : if rem=0 then
               print "number even"
           else
               print "number odd"
           end if
step 5 : stop



                                            Flowchart:-

1. Graphical representation of any program is called flowchart.

2. There are some standard graphics that are used in flowchart as following:








Q. Make a flowchart to input temperature, if temperature is less than 32 then print "below freezing" otherwise print  "above freezing"?
Ans.










Read More

How To Increase Internet Speed without the use of any software

Posted by Tushar Bedekar

Many times we find that our internet speed is slow and we get tired to use it for a long time. Now here is the solution. Actually.Actually what our PC or Our Laptop reserves some amount of the internet bandwidth(nearly 20% default). And now if we make this reserved band width to a zero than the internet speed can be increased by the certain amount.So in order to increase your internet speed just follow the steps given below:-

Steps:-


  • First of all open run just by pressing the keyboard shortcut(windows key +R)
  • Then enter the command given below:-                                              gpedit.msc
  • Now a windows opens having the name (local group policy editor)
  • In the left most corner it has been written (administrative temp lets)
  • Inside that administrative temp-lets click on the network.
  • Now in the right hand side window you will find QoS packet scheduler.
  • Now double click on that.
  • After Double clicking it you will find the option limit reversible bandwidth.
  • Again Double click on that.
  • you will find the option bandwidth limit (%) in which 20 or any other value is being written.
  • Make it zero and than click apply.
  • Now you have done.
  • Then restart your Browser you will find some speed has been increased.  

Screen Shots:-


http://www.allaboutcomputing.net/
 http://www.allaboutcomputing.net/

http://www.allaboutcomputing.net/
http://www.allaboutcomputing.net/

Warning:-

  • We are not responsible for any damages that may happened by using this Techniques. 
  • Use this guide at your own risk. We shall not have any liability or responsibility for whatever happens to you and your device by using the instructions in this guide.
  • The instructions provided in this tutorial for educational purpose only. There is no guarantee that these steps will work for your device.
  •  Applying this guide to any other device or any other model may produce many problems.
  • Read and Understand the whole tutorial first, before going to perform the steps.
  • At the same time this content is not to harm any one but it is only for educational purpose.


Read More

Fibonacci series by Recursion in c

Posted by Tushar Bedekar

Introduction:-

http://www.allaboutcomputing.net/
Recursion is the process of repeating items in a self-similar way. In other words recursion is a process in which a same set of a statement/expressions are executed large no of times in such a manner that after the execution of a certain set of a statement/expression, again the same set of a statement/expressions are being executed until the condition is satisfied. Generally this kind of a process takes place in the in functions in which a function calls itself. The following is the syntax of the recursive function:-
void recursion()
{
   recursion(); /* function calls itself */
}

int main()
{
   recursion();
}
http://www.allaboutcomputing.net/Actually most of the programming languages support recursion an C programming language is one of them i.e., a function to call itself. But while using recursion, programmers need to be careful to define an exit condition from the function, otherwise it will go in infinite loop.
Recursive function are very useful to solve many mathematical problems like to calculate factorial of a number, generating Fibonacci series, etc.

Program me:-


/* Fibonacci by Recursion */
#include<stdio.h>
http://www.allaboutcomputing.net/
int fib(int); int main() { printf("Type any value : "); printf("\nNth value: %d",fib(getche()-'0')); return 0; } int fib(int n) { if(n<=1) return n; return(fib(n-1)+fib(n-2)); }
Read More

C Programming to Explain Type Casting

Posted by Tushar Bedekar

Introduction:-

Type casting is a way to convert a variable from one data type to another data type. For example, if you want to store a long value into a simple integer then you can type cast long to int. You can convert values from one type to another explicitly using the cast operator as follows:


Program me:-

#include< stdio.h>
#include< conio.h>
int main( )
{
int n,i,j,fact;
float sum=0;
clrscr();
for(i=1; i<=7; i++) { fact=1; for(j=i; j>=1; j--)                       // to find the factorial
fact=fact*j;

sum=sum+(float)i/fact;
}
printf("\nSum : %f",sum);
getch();
return 0;
}

Read More

Modifiers in C Programming Language

Posted by Tushar Bedekar
C Programming Modifier
As We Have discussed in the last article about C Programming   the data types have some modifiers preceding them. The use of these modifiers changes the meaning of the base type.

The memory in the computer is organized in terms of units called bytes. One  byte consists of 8 bits and bit is a smallest unit of memory.

Need of Data Modifiers:

The Need of modifiers can be understood by the help of following.Let us take an example of a Program where we need to input the “Salary” of “Employees” in a team. This program will accept the salary as an input from user and then calculate the Income Tax of that user. We use “int” to store the Salary of the employee as we are assuming that the salary will be in “Whole Numbers”.
C Programming Modifier

An integer data type takes 2 Bytes of Memory and we are aware that the Salary of any of the employee can not be “Negative”. We are using “2 Bytes” to store the memory of an Employee and we can easily save 1 Byte over there by removing the “Signed Part” in the integer. This positive value can easily be stored in “1 Bye Int” This leads us to the user of Data Type Modifiers.

Types of Data Modifiers in C:

Basically c programming language consist of 3 basic modifiers.The modifiers are listed below :


Signed Type Modifier:



All data types are “signed” by default. Signed Data Modifier implies that the data type variable can store positive values as well as negative values.


For example, if we need to declare a variable to store temperature, it can be negative as well as positive.

C Programming Modifier
signed int temperature;


Or


int temperature;



Unsigned Type Modifier:



If we need to change the data type so that it can only store only store positive values, “unsigned” data modifier is used.


For example, if we need to declare a variable to store the salary of an employee as explained above, we will use “Unsigned” Data Qualifier here.


unsigned int salary;


Long Type Modifier:


Sometimes while coding a program, we need to increase the Storage Capacity of a variable so that it can store values higher than its maximum limit which is there as default. In such situations or programs, we need to make use of the “long” data type qualifier. “long” type modifier doubles the “length” of the data type when used along with it.

C Programming Modifier
For example, if we need to store the “annual turnover” of a company in a variable, we will make us of this type qualifier.


long int turnover;


This variable will take 4 Bytes in memory.



Short Type Modifier:



A “short” type modifier does just the opposite of “long”. If one is not expecting to see high range values in a program and the values are both positive & negative.

C Programming Modifier
For example, if we need to store the “age” of a student in a variable, we will make use of this type qualifier as we are aware that this value is not going to be very high.


short int age;


This variable will consume only 1 Byte in memory.



Example

We can apply the above mentioned modifiers to integer (int) and character (char) base types.


1. Integer Type Modifiers:



* We can use all the above mentioned Type Modifiers for int data type in C Language

* Short int and long int are also termed as short and long respectively.
* Int is signed & unsigned by default.


2. Character Type Modifiers:



* Variables of type char consume 1 byte in memory.

* Char can be signed or unsigned only.
* They have a range of -128 to 127 and 0 to 255 for signed & unsigned respectively.


3. Float Type & Double Type Modifier:



There are 3 types of float type modifiers as given below:

C Programming Modifier


* float

* double
* long double

Double is same as long float. Float type occupies 4 bytes of memory. Type double occupies 8 bytes. Long double occupies 10 bytes. The exception to this is long double, which modifies the size of the double data type to 10 bytes. Please note that in some compilers this has no effect.



Note: We may use long modifier with double data type but it cannot be used with float, i.e. long double is allowed but long float is not allowed because long float is equal to double.


For More Info Download:-

                                                                                                                                                                       
Tushar
                                                           
Read More

What is a Hard Drive and How it Works

Posted by Tushar Bedekar

What is a Hard Drive:-

Inside a hard rive
Almost all desktop computers as well as laptops have a hard drive inside them, but do you really know what they are? Many people when they hear the word hard drive, think that it refers to the computer as a whole. In reality, though, the hard drive is just one of many different pieces that comprise a computer. The hard drive is one of the most important parts of your computer because it is used as a long-term storage space for your data. What that means, is regardless of whether or not the computer is on, or you lose power, the data will still stay stored on this hard drive keeping it safe. 
A hard drive is an integral part of your computer as your operating system and all your data are typically stored there. In the majority of the situations, if you did not have a working hard drive, or the hard drive malfunctions, you would not be able to boot your computer into the operating system and would get an error. 

How hard drives work:

The very interesting thing is that every one wants to know that how the Hard Drive works and how the data gets stored permanently for a long time even if the power is off.

A hard drive consists of the following:


    hard drive
  • Magnetic platters - Platters are the round plates in the image above. Each platter holds a certain amount of information, so a drive with a lot of storage will have more platters than one with less storage. When information is stored and retrieved from the platters it is done so in concentric circles, called tracks, which are further broken down into segments called sectors.
  • Arm - The arm is the piece sticking out over the platters. The arms will contain read and write heads which are used to read and store the magnetic information onto the platters. Each platter will have its own arm which is used to read and write data off of it.
  • Motor - The motor is used to spin the platters from 4,500 to 15,000 rotations per minute (RPM). The faster the RPM of a drive, the better performance you will achieve from it.
When a the computer wants to retrieve data off of the hard drive, the motor will spin up the platters and the arm will move itself to the appropriate position above the platter where the data is stored. The heads on the arm will detect the magnetic bits on the platters and convert them into the appropriate data that can be used by the computer.Actually these magnetic Bits are also refers to as a magnetic domains which gets align themselves according to the binary zeroes and ones. 
Conversely, when data is sent to the drive, the heads will this time, send magnetic pulses at the platters changing the magnetic properties of the platter, and thus storing your information.
It is important to note, that since the data stored on your hard drive is magnetic, that why the people are supposed to warn that don`t take the magnet near the Hard drive because it may affect the magnetic Data Stored on the Hard Drive. 


Hard Drive Interfaces:-



Hard Drive
A hard drive connects to your computer through a specific type of interface. The interface on your hard drive must match the corresponding interface on your motherboard. If you purchase a new hard drive that has a interface which doesn't matches with the interface of the Mother Board Installed on your Computer, then it will not work in your computer. Basically there are three interfaces that have become the standard for connecting your hard to your computer. Some information about each of these interfaces are below.
  • IDE or ATA - This is currently the most common interface used but is quickly becoming overcome by the newer SATA interface. Hard drives using this type of interface have speeds up to 100 Mbps.
  • SATA - A newer interface that uses less bulky cables and has speeds starting at 150 Mbps for SATA and 300 Mbps for SATA II. Almost all computer manufacturers have started using SATA drives.
  • SCSI - This type of interface is typically used in a business environment for servers. Hard Drives designed for a SCSI interface tend to have a faster RPM which therefore provides better performance.
Read More

C Programming Data Type

Posted by Tushar Bedekar
In C, variable(data) should be declared before it can be used in program. Data types are the keywords, which are used for assigning a type to a variable.In other words we can define the data type as a keyword which specifies the type of the data to be processed during the execution of the program me. 

Data types determine the following:

• Range of the data
• Type of the data stored
• Number of bytes it occupies in memory





C supports following data types:

• int – occupies 2 (16-bit compiler) or 4 bytes (32-bit compiler) of memory
• float – occupies 4 byes of memory
• double – occupies 8 bytes of memory
• char – occupies 1 byte of memory

Integer Data Type:-

int is used to define integer numbers. It occupies 2 bytes of memory (16-bit compiler).Keyword int is used for declaring the variable with integer type. For example:
The size of int is either 2 bytes(In older PC's) or 4 bytes. If you consider an integer having size of 4 byte( equal to 32 bits), it can take 232 distinct states as: -231,-231+1, ...,-2, -1, 0, 1, 2, ..., 231-2, 231-1
Similarly, int of 2 bytes, it can take 216 distinct states from -215 to 215-1. If you try to store larger number than 231-1, i.e,+2147483647 and smaller number than -231, i.e, -2147483648,  program will not run correctly.

Float Data Type:-

float is used to define floating type numbers. It occupies 4 bytes of memory
(16-bit compiler).Variables of floating types can hold real values(numbers) such as: 2.34, -9.382 etc. Keywords either float or double is used for declaring floating type variable. For example:

Double Data Type:-

double is used to store big floating point numbers. It reserves 8 bytes of memory (16-bit compiler)

Difference between float and double:-

Generally the size of float(Single precision float data type) is 4 bytes and that of double(Double precision float data type) is 8 bytes. Floating point variables has a precision of 6 digits whereas the the precision of double is 14 digits.
Note: Precision describes the number of significant decimal places that a floating values carries.

Char Data Type:-

char is used to store characters. It occupies 1 byte of memory (16-bit compiler).The size of char is 1 byte. The character data type consists of ASCII characters. Each character is given a specific value. For example:

Summary:

Following table is applicable for 16-bit compiler.

Read More
back to top