Posts

What is Character set

Image
What is Character set A Character denotes any alphabets, digits and special symbols used to represent information  for Example alphabets A,B...Y,Z Or a,b...y,z Digits 0,1,2,3,4,5,6,7,8,9 Special symbols `~ !@#$%^&*()_+-=}{|":<>?/.,;'\][  Constants, variables and keywords The alphabets, digits and special symbols when properly combined from constants, variable and keywords. A constants is an entity that doesn't change, whereas, a variable is an entity that may change. A keyword is a word that carries special meaning. In any C program, we typically do lots of calculations. The result of these calculation are store in memory of computer, Like human memory, the memory of computer also consists of millions of cell. The calculated value are store in the brain. That way computer are calculation store in memory ( as hard disk etc). Since the value stored in each locations may change. In programming language, constants are often called literals, whe...

What is C

Image
 Learn Programming C  Now See First Topic- Getting Started What is C? C is a programming language developed AT Bell laboratories of USA in 1972. It was designed and written by Dennis Ritchie. C become popular because it is reliable, simple and technologies emerge and really good.  An opinion that is that is often heard today is " C has been already superseded by language like C, C# or Java. There are several reasons for this. There are as follows:- C++, C# or Java make use of a principle called object oriented programming (OOP) to organize the program,You would still need a good hold over the language elements of C and the basic programming skills. So it make more sense to first learn C and then migrate to C++, C#, Java . Though this two-step learning process may take more time, but at the end of it, you will definitely find it worth the trouble. Major part of popular operating systems like Window, Linux, UNIX, etc. and android are written in C. moreover, if one is t...

Program to find the length of the string entered by user

Program to find the length of the string entered by user #include <stdio.h> #include <conio.h> void main() { int i= 0; char ch, str[20]; clrscr(); printf ("Enter the string: "); gets(str); ch=str[0]; while (ch!='0') { i++; ch= str[i]; } printf ("Length is %d", i); getch(); }

Program to insert a user-defined element at specific location

Program to insert a user-defined element at specific location #include <stdio.h> #include <conio.h> void main() { int A[10], i, num, pos, n; clrscr(); printf ("Enter the number of elements: "); scanf ("%d", &n); printf ("Enter the data: "); for ( i=0; i<n; i++) { scanf ("%d", &A[i]); } printf ("Enter the new element value and it's position: "); scanf ("%d%d", &num, &pos); for ( i=n; i>pos; i- -) { A[i+1]=A[i]; } A[pos]=num; printf ("New array is: \n"); for (i=0;i<n+1;i++) { printf ("%d\t", A[i]); } getch(); }

Program to arrange the elements of an array using Bubble Sort

Program to arrange the elements of an array using Bubble Sort #include <stdio.h> #include <conio.h> void main() { int A[10], i, j, n, temp; clrscr(); printf ("Enter the number of elements: "); scanf ("%d", &n); printf ("Enter the data: "); for ( i=0; i<n; i++ ) { scanf ("%d", &A[i]); } for ( i=0; i<n; i++ ) { for ( j=0; j<n-i; j++ ) { if ( A[j] > A[j+1]) { temp = A[j]; A[j] = A[j+1]; A[j+1]=temp; } } } printf ("Sorted Array is "); //Sorted in Ascending Order for ( i=0; i<n; i++ ) { printf ("%d\t", A[i]); } getch(); }

Program to declare a user defined array and print the sum of odd and even numbers

Program to declare a user defined array and print the sum of odd and even numbers. #include <stdio.h> #include <conio.h> void main() { int a[10], i, sume=0, sumo= 0, n; clrscr(); printf ("Enter the size of an array: "); scanf ("%d", &n); if (n<=10) { printf ("Enter the array data: "); for (i=0;i<n;i++) { scanf ("%d", &a[i]); } for (i=0;i<n;i++) { if (a[i]%2==0) sume = sume + a[i]; else sumo = sumo + a[i]; } printf ("Sum of odd number = %d and sum of even number = %d", sumo, sume); } else printf ("\nSize is too large."); getch(); }

Program to print the sum of each row and each column of a matrix separately

Program to print the sum of each row and each column of a matrix separately #include <stdio.h> #include <conio.h> # define SIZE 3 void main() { int A[SIZE][SIZE]; int row, col, sum = 0; /* Input elements in matrix from user */ printf ("Enter elements in matrix of size %dx%d: \n", SIZE, SIZE); for (row=0; row<SIZE; row++) { for (col=0; col<SIZE; col++) { scanf ("%d", &A[row][col]); } } /* Calculate sum of elements of each row of matrix */ for (row=0; row<SIZE; row++) { sum = 0; for (col=0; col<SIZE; col++) { sum += A[row][col]; } printf ("Sum of elements of Row %d = %d\n", row+1, sum); } /* Find sum of elements of each columns of matrix */ for (row=0; row<SIZE; row++) { sum = 0; for (col=0; col<SIZE; col++) { sum += A[col][row]; } printf ("Sum of elements of Column %d = %d\n", row+1, sum); } getch(); }