Posts

Showing posts with the label C programming

Database Administrator

Image
     I n a very general sense, a database administrator is the individual responsible for maintaining the RDBMS system. The DBA has many different responsibilities, but the overall goal of the DBA is to keep the server up at all times and to provide users with access to the required information when they need it. The DBA makes sure that the database is protected and that any chance of data loss is minimized.   A DBA can be someone who, from the start, has concentrated in the area of database design and administration. A DBA can be a programmer who, by default or by volunteering, took over the responsibility of maintaining a database server during project development and enjoyed the job so much that he switched. A DBA can be a system administrator who was given the added responsibility of maintaining a database server. DBAs can even come from unrelated fields, such as accounting or the help desk, and switch to Information Systems to become DBAs. A DBA needs the ...

What is Function? Write a program to demonstrate any two string function using C.

Image
  A function is a  block of statements that performs a specific task .  In c, we can divide a large program into the basic building blocks known as function. The function contains the set of programming statements enclosed by {}. A function can be called multiple times to provide reusability and modularity to the C program. In other words, we can say that the collection of functions creates a program. The function is also known as  procedure  or  subroutine  in other programming languages.

What is Array in C? Write a program to sort numbers in descending order.

  An array is a collection of data items, all of the same type, accessed using a common name. A one-dimensional array is like a list;  A two dimensional array is like a table;  The C language places no limits on the number of dimensions in an array, though specific implementations may. #include <stdio.h> void main ( ) {   int number [ 30 ] ;   int i , j , a , n ; printf ( "Enter the value of N \n " ) ; scanf ( "%d" , & n ) ;   printf ( "Enter the numbers \n " ) ; for ( i = 0 ; i < n ; ++ i ) scanf ( "%d" , & number [ i ] ) ;   /* sorting begins ... */   for ( i = 0 ; i < n ; ++ i ) { for ( j = i + 1 ; j < n ; ++ j ) { if ( number [ i ] < number [ j ] ) { a = number [ i ] ; number [ i ] = number [ j...

Difference on Break and Continue Statement in C

Image
 

C program to check whether inputted number is prime number or not.

Image
P rime numbers are divisible only by 1 and by themselves. 2,3,5,7,11 etc are prime numbers. These numbers are only divisible by 1 and by themselves. To check whether a given number is prime number or not, at first, we start a loop from 1 to given number and check as if it is divisible the loop incremented number and if it is, then we will print that given number is prime number and also if it is 2, we will directly check it and print that given number is prime number. Have a look here, The Output

C program to display prime numbers between 1 to 100.

Image
 P rime Numbers are those which have only 2 factors; by 1 and by themselves own. For examples, the first five prime numbers are 2,3,5,7 and 11. These numbers are divisible by 1 and by themselves. Here, we have to print prime numbers from 1 to 100. So, we have to use for loop. The nested for loop works here, one by variable 'a' and another by 'b' and an increment number is also stored in 'p'. The first loop starts from 1 and inside it, another loop begins until the value of b becomes greater then a. If the remainder when a is divided by b becomes 0. The value of p incremented by 1. If the value is 2 means that first loop also has moved for 2 and value of a is 2. And, so it get printed. The first prime number is extracted and now whenever the divisible of a by b becomes 0, the value inside a gets printed and we will get all the prime numbers.    The Output

Header Files in C

H eader Files contain definitions of functions and variables, which is imported or used into any C program by using pre-processor i.e, #include statement. Header files have an extension ".h" which contains C function declaration and macro definition. For example, stdio.h is a header file contains declaration of input and output functions available in C. Similarly math.h contains declarations of mathematical functions available in C.

Basic Concept of Programming and GIGO

A computer performs task in the following concept 1. It takes input before proceeding form input devices 2. The computer perform necessary operation on data 3. The output is generated after the processing is completed So while doing programming you must provide input and provide instruction to perform some operation. The output will be generated as your instruction and should be displayed or perform. G igo Gigo is a term that defines about the performing procedure of a machine. It says that computer will produce the output not of your need, rather it will produce the output as according to the input provided. Garbage In-Garbage out, means that it will produce meaningless output, if you have provided wrong input. For example, the you want a program that produce the city name in alphabetical order but if you have provided the name of animals as input then the output will sort the name of animals in alphabetical order, not the name of cities.

Data types in C

Data types specifies the type of data that a variable can store. For example a variable can store either integer, float, string etc Data types used in C are int, float, double, char, array, pointer, enum etc Variable with data type declaration is int a; float bc1; char b;

Variable, Keyword and constant

V ariables are the container/store house for any data that is inputted. To acquire space for the data to provide, space should be given name. Variables are just symbolic representation of memory location. For example:  a, x, y, abc, ab1 etc Rules for writing variables: A variable can have alphabets, digits and underscore A variable name must start with alphabets or underscore but not with digit No whitespace is allowed within in variable name A variable name must not be reserved keyword K eyword A reserved word in C programming is known as keyword. Keyword cannot be used as variable name. These are the keyword of C programming auto break case continue register char const do double while default else if goto for long return short signed long register switch typedef union struct void volatile int float extern enum volatile  Constant A constant is a value or variable that cannot be changed in the program. For example 10, 20, 'a', ...

Introduction

C programming is one of the powerful programming language. It is procedural programing language that makes a machine to follow the instruction step by stem from top to bottom. It is developed by Dennis Ritche in 1972 AD at AT and T bell laboratories. C programming is very useful for learning programming. You must have begin your journey learning C in order to became a great programmer and to learn programming in deep, C is must. The key advantages of C programming are Easy to learn Structured programming Produce effective programs Can handles low level language issues easily Programs written in it can be compiled any where The Applications of C programming are Operating System Language Compilers Text Editors  Print Spoolers etc