Thursday, November 30, 2017

Key Board Shortcuts in Windows with Windows key

Key Board Shortcuts in Windows with Windows key

Windows + D    ----> Desktop
Windows + E     ----> Windows Explorer
Windows + R     ----> Open Run command prompt
Windows + X     -----> Windows Mobility Manager
Windows + M    -----> Minimize all
Windows  + L    -----> Lock system
Windows + F      -----> To find in the system
Windows + P      ------> To get projector options
Windows + number ---> To open that tab in the task bar

Why C language still exists and its importance

What are these computer languages?
Ans: Computer languages are just like languages we(Humans) have to communicate with each other.
But computer language is for communicating with computers.

If I want to speak with American, I need to know English. Similarly to assign work for the computer we need to know computer language.

Machine are there to do our work. But we have to instruct them. We will instruct in their language.

It is 2 types:
1. Low level
2. High level

Low level is like mother tongue, High level is like other than mother tongue.

High level language has to be converted into low level language to be executed bu the computer similarly as we did.

Why we are still using C language?
Even though you are proficient in English, when some one asks a question it will be translated to mother tongue and answer will be framed. Translating it back to English.

How much proficient you are certain things can't be explained in other languages. It can be done only in mother tongue. Even though English is sophisticated we can't leave mother tongue.

I will call C language as very close language to computers mother tongue. Memory access and peripheral device access can be done only with C programming. C language is used to build foundation for all the Electronic systems. On top of that we can do many things with many languages.

You can put foundation only with "C".

So, lets have a look at C, when you have time.

How to print elements of matrix in circular fashion or rounded snake method for both rectangular and square matrix.

How to print elements of matrix in circular fashion or rounded snake method for both rectangular and square matrix.

Did it in static way for easy understanding.

void round_print(int matrix[6][5], int l,int m) {
    int i,j,n;
    if(l>m)
        n=l;
    else
        n=m;                      //to find biggest of column and row

    for (int layer = 0; layer < n / 2; ++layer) {    //For printing in layers
        int first = layer;
        int last_c = m - 1 - layer;           //last column
        int last_r = l - 1 - layer;             //last row
        for(i = first,j=first; j < last_c; ++j) {     //Printing top row
            printf("%d ",matrix[i][j]);
        }
        for(i = first,j=last_c; i < last_r; ++i) {  //right column
            printf("%d ",matrix[i][j]);
        }
        for(i = last_r,j=last_c; j > first; --j) {   //bottom row
            printf("%d ",matrix[i][j]);
        }
        for(i = last_r,j=first; i > first; --i) {    //left column
            printf("%d ",matrix[i][j]);
        }
    }
    if(n%2)                                     // For odd number middle element will be missed
            printf("%d",matrix[n/2][n/2]);
}

int main(){
    int matrix[6][5] = {{1,2,3,4,5},{6,7,8,9,10},{11,12,13,14,15},{16,17,18,19,20},{21,22,23,24,25},{26,27,18,19,30}};
    for(int i=0;i<6;i++){
        for(int j=0;j<5;j++)
            printf("%3d ",matrix[i][j]);
        printf("\n");
    }
    round_print(matrix,6,5);
    return 0;
}

Tuesday, September 25, 2012

8086 program to add 2 32-bit numbers

To write 8086 Assembly Language Program to add two 32-bit signed & unsigned number

code:

MOV AX,5000H ; Initialize DATA SEGMENT
MOV DS,AX ; to 5000H
MOV AX,[1000H] ; take lower 16-bit of NUM1 in AX
MOV BX,[2000H] ; take lower 16-bit of NUM2 in BX
ADD AX,BX ; AX = AX + BX
MOV [3000H],AX ; Store lower 16-bit result at NUM3
MOV AX,[1002H] ; take higher 16-bit of NUM1 in AX
MOV BX,[2002H] ; take higher 16-bit of NUM2 in BX
ADC AX,BX ; AX = AX + BX + CF (add with carry)
MOV [3002H],AX ; Store higher 16-bit result at NUM3
HLT ; Halt 8086


Windows Shortcuts


                                                                 Windows Shortcuts

Execute below command s from run promt

appwiz.cpl  ----> Add/Remove Programs
 access.cpl  ----> Accessibility Controls

 hdwwiz.cpl  ----> Add Hardware Wizard

  control admintools   ----> Administrative Tools
  wuaucpl.cpl   ----> Automatic Updates

 fsquirt   ----> Bluetooth Transfer Wizard
  calc   ----> Calculator

  certmgr.msc   ----> Certificate Manager

  charmap   ----> Character Map


Monday, September 10, 2012

Prime Numbers Program

Write a program to find prime numbers upto entered number in shortest number of loops


Solution:


#include<stdio.h>
main()
{
int a,b,c,d;
clrscr();
printf("Enter number upto which you want prime numbers:\n");
scanf("%d",&a);
 for(c=2;c<a;c++)//c=2 for excluding 1
  {
for(b=1,d=0;b*b<=c;b++)//d must be initialised every time
{
if(c%b==0)
d++;
}
if(d==1)
printf("%d\t",c);
  }
getch();
return(0);
}

LOOP Program in c


(f) Write a program to produce the following output:
ABCDEFGFEDCBA
ABCDEF   FEDCBA
ABCDE       EDCBA
ABCD           DCBA
ABC                CBA
AB                     BA
A                          A

Solution:


#include<stdio.h>
main()
{
int i,j,k,m;
clrscr();
for(k=72;k>64;k--)
{
for(i=65;i<k;i++)
printf("%c",i);
for(m=2*(72-k)-1;m>0;m--)//for providing odd No. of spaces
printf(" ");
if(k==72)
j=k-2;
else
j=k-1;
for(j;j>64;j--)
printf("%c",j);

printf("\n");
}
}