Saturday, December 24, 2011

Middle level Language

Q. Why C is called middle level language?

Ans.

It is common question in interview that why C language is called a Middle level language? Before find out this answer, you should familiar with following term:
There are following reason that C is called Middle Level Language as:

  1. C programming language behaves as high level language through function, it gives a modular programming and breakup, increased the efficiency for resolvability. 
  2. C programming language support the low level language i.e. Assembly Language.
  3. C language also gives the facility to access memory through pointer.
  4. Its combines the elements of high-level languages with the functionalism of assembly language.
So, C language neither a High Level nor a Low level language but a Middle Level Language.

Learn also:
  1. What is the use of C program in real life?

Low Level Language

LLL is stand for Low Level Language. These language also known Machine Language. Definition and some Basic features of low level Language is as following:
  • The language whose design is governed by the circuitry and the structure of the machine is known as Machine Language.
  •  These language is difficult to learn and use.
  • These language is machine-dependent.
  • In these type language program execution is faster compere high level language because code is directed accepted by the machine, no needs to translator.
  • Example of Low level Language is the Assembly Language.
Learn also:
  1. What is High Level Language?
  2. Why C is called Middle Level Language?
  3. What is the use of C programs in real life?

High Level Language


HLL stands for High Level Language. Basic features of HLL is as  following:
  • These language are particularly oriented towards describing the procedures for solving the problem in a concise, precise and unambiguous manner. 
  • HLL are programming language which is user friendly, easy to learn and writing program, to extent platform independent.
  • Hll language are machine independence so its require Compiler or Translator to translate these code in machine language.
  • Examples of high level languages are C, C++, Java,FORTRAN etc.
Note: FORTRAN is first High Level Language.


Learn also :
  1. What is Low Level Language?
  2.  Why C is called middle level Language?

Convert string UpperCase

Q. Write a string to accept string through keyboard and convert it Uppercase letter.

Ans.

/*program to convert a string in upper case letter*/
#include<stdio.h>
#include<string.h>
int main()
{
 char str[40];
 int i;
 printf("Enter any string : ");
 gets(str);
 for(i=0; str[i]!=NULL; i++)
 {
   if(str[i]>='a' && str[i]<='z')
   {
      str[i]=str[i]-32;
   }
 }
 str[i]='\0';
 puts(str);
 getch();
 return 0;
}

Output:-

Enter any string : My C ProgrammING CodeS
MY C PROGRAMMING CODES

Convert string LowerCase

Q. Write a string to accept string through keyboard and convert it Lower Case letter.

Ans.

/*program to convert a string in lower case letter*/
#include<stdio.h>
#include<string.h>
int main()
{
 char str[40];
 int i;
 printf("Enter any string : ");
 gets(str);
 for(i=0; str[i]!=NULL; i++)
 {
    if(str[i]>='A' && str[i]<='Z')
    {
       str[i]=str[i]+32;
    }
 }
 str[i]='\0';
 puts(str);
 getch();
 return 0;
}

Output:-
Enter any string : My C ProgrammING CodeS
my c programming codes

Friday, December 23, 2011

Number pattern

Q. Write a C program to display the following pattern:
 1
 2   3
 4   5    6
 7   8    9    10
11  12   13    14  15

Ans.

/*program to design the above pattern*/
#include<stdio.h>
#include<conio.h>
void main()
{
 int r,c,n=1;
 clrscr();
 for(r=1; r<=5; r++)
 {
  for(c=1; c<=r; r++)
  {
    printf("%3d",n++);
  }
  printf("\n");
 }
 getch();
}

Output:-

 1
 2   3
 4   5    6
 7   8    9    10
11  12   13    14  15

Sunday, December 18, 2011