Thursday, February 28, 2019

UNIX COMMAND

1. Find the current time and date.

[bgc@localhost ~]$ date
Thu Aug 23 04:54:01 EDT 2018
[bgc@localhost ~]$

2. Create a blank file.

[bgc@localhost ~]$ touch aniket.txt
[bgc@localhost ~]$

3. Create a file and write some sentences on the file.

[bgc@localhost ~]$ cat>file1.txt
today is thursday
I am a student
Bhairab Ganguly College
[bgc@localhost ~]$

4. Display the content of the file file1.txt

[bgc@localhost ~]$ cat file1.txt
today is thursday
I am a student
Bhairab Ganguly College
[bgc@localhost ~]$

5. Append some lines in a text file.

[bgc@localhost ~]$ cat>>file1.txt
tomorrow is friday
[bgc@localhost ~]$ cat file1.txt
today is thursday
I am a student
Bhairab Ganguly College
tomorrow is friday
[bgc@localhost ~]$

6. Create a directory or folder.

[bgc@localhost ~]$ mkdir Aniket
[bgc@localhost ~]$

7. Display all files and directories under the current directory.

[bgc@localhost ~]$ dir
10.sh~      7.sh~      even   nelash.sh
143.cpp~      8a.sh      evenoddchecking.sh   nelash.sh~
144.cpp~      8a.sh~      evenoddchecking.sh~  nelash.txt
145.cpp~      8.sh      f1   nelash.txt~
146.cpp~      8.sh~      f2.cpp~   odd
147.cpp~      9.sh~      f8.cpp~   p1.cpp~
148.cpp.cpp~  a      file1.txt   p2.cpp~
149.cpp~      A\ K\ PATWA\ 9564\ BGC  file.c~   p3.cpp~
150.cpp~      aman~      file.txt   paddy
151.cpp~      aman2~      file.txt~   paddy1.txt
152.cpp~      Aniket      final.c   Pictures
153.cpp~      aniket.txt      first.c~   Public
154.cpp~      aniket.txt~      F_to_c.cpp~   puli1.c~
1.sh      archie.sh      HMS.cpp~   rajdeep.doc
1.sh~      archie.sh~      joy   rajdeep.txt
2.sh      Archisman.sh      joy1.sh   rajdeep.txt~
2.sh~      Archisman.sh~      joyblank.sh   reverse.sh
3.sh      Archisman.txt      joyblank.sh~   reverse.sh~
3.sh~      Archisman.txt~      joymarks.sh   sdsir.c~
4.sh      arm.sh      joyword.sh   source.txt
4.sh~      arm.sh~      joyword.sh~   student1.txt
5.sh      assignment1.sh      joyyy.sh   student1.txt~
5.sh~      assignment1.sh~      joyyy.sh~   t19.txt
6a.sh~      bubble.c~      km_to_mile.cpp~   t2.txt
6b.sh~      checking.sh      linear.sh   t2.txt~
6c.sh~      Debayan      linear.sh~   Templates
6.sh      Desktop      Music   triangle.txt~
6.sh~      destination.txt      nealash2.txt   Untitled\ Folder
7a.sh~      Documents      nelash2.sh   Videos
7b.sh~      Downloads      nelash2.sh~   vowelcheck.txt
7c.sh~      DtoB.sh      nelash3.sh
7.sh      DtoB.sh~      nelash3.sh~
[bgc@localhost ~]$

8. Display all files and directories under the current directory.

[bgc@localhost ~]$ ls
10.sh~        7.sh~      even nelash.sh
143.cpp~      8a.sh      evenoddchecking.sh nelash.sh~
144.cpp~      8a.sh~      evenoddchecking.sh~ nelash.txt
145.cpp~      8.sh      f1 nelash.txt~
146.cpp~      8.sh~      f2.cpp~ odd
147.cpp~      9.sh~      f8.cpp~ p1.cpp~
148.cpp.cpp~  a      file1.txt p2.cpp~
149.cpp~      A K PATWA 9564 BGC  file.c~ p3.cpp~
150.cpp~      aman~      file.txt paddy
151.cpp~      aman2~      file.txt~ paddy1.txt
152.cpp~      Aniket      final.c Pictures
153.cpp~      aniket.txt      first.c~ Public
154.cpp~      aniket.txt~      F_to_c.cpp~ puli1.c~
1.sh          archie.sh      HMS.cpp~ rajdeep.doc
1.sh~         archie.sh~      joy rajdeep.txt
2.sh          Archisman.sh      joy1.sh rajdeep.txt~
2.sh~         Archisman.sh~      joyblank.sh reverse.sh
3.sh          Archisman.txt      joyblank.sh~ reverse.sh~
3.sh~         Archisman.txt~      joymarks.sh sdsir.c~
4.sh          arm.sh      joyword.sh source.txt
4.sh~         arm.sh~      joyword.sh~ student1.txt
5.sh          assignment1.sh      joyyy.sh student1.txt~
5.sh~         assignment1.sh~     joyyy.sh~ t19.txt
6a.sh~        bubble.c~      km_to_mile.cpp~ t2.txt
6b.sh~        checking.sh      linear.sh t2.txt~
6c.sh~        Debayan      linear.sh~ Templates
6.sh          Desktop      Music triangle.txt~
6.sh~         destination.txt     nealash2.txt Untitled Folder
7a.sh~        Documents      nelash2.sh Videos
7b.sh~        Downloads      nelash2.sh~ vowelcheck.txt
7c.sh~        DtoB.sh      nelash3.sh
7.sh          DtoB.sh~      nelash3.sh~
[bgc@localhost ~]$

9. Details of all processes that are currently executing

[bgc@localhost ~]$ ps
 PID   TTY       TIME CMD
2807 pts/1    00:00:00 bash
2889 pts/1    00:00:00 ps

[bgc@localhost ~]$

BASIC DOS COMMAND

1.create a sub directory NEW and a sub directory EXAM under it.
C:\Users\cs-14>md NEW

C:\Users\cs-14>cd NEW

C:\Users\cs-14\NEW>md EXAM

C:\Users\cs-14\NEW>cd EXAM
2. create two files TEST1 and TEST2 in a sub directory EXAM.
C:\Users\cs-14\NEW\EXAM>copy con TEST1
CMSA^Z
       1 file(s) copied.

C:\Users\cs-14\NEW\EXAM>copy con TEST2
MTMG^Z
       1 file(s) copied.
3.copy the contain of TEST1 into TEST3.
C:\Users\cs-14\NEW\EXAM>copy TEST1 TEST3
       1 file(s) copied.
4. Delete the file TEST1.
C:\Users\cs-14\NEW\EXAM>del TEST1
5.Rename the file TEST3 toTEST4.
C:\Users\cs-14\NEW\EXAM>ren TEST3 TEST4
6.Display the file TEST1.
C:\Users\cs-14\NEW\EXAM>edit TEST1
7.delete the folder EXAM.
C:\Users\cs-14\NEW\EXAM>del TEST2

C:\Users\cs-14\NEW\EXAM>del TEST4
    
C:\Users\cs-14\NEW\EXAM>cd..

C:\Users\cs-14\NEW>rd EXAM
8.Delete the folder NEW.
C:\Users\cs-14\NEW>cd..

C:\Users\cs-14>rd NEW

C:\Users\cs-14>

LCM OF TWO NUMBERS


#include<stdio.h>
void main()
{
 int a,b,i,l;
 printf("enter the first element");
 scanf("%d",&a);
 printf("enter the second element");
 scanf("%d",&b);
 for(i=1;;i++)
 {
  if(i%a==0&&i%b==0)
  {
   l=i;
   break;
  }
 }
 printf("%d",l);
}

GCD OF TWO NUMBERS C LANGUAGE CODE


Program code:
#include<stdio.h>
void main()
{
 int m,n,i,g;
 printf("enter the first element");
 scanf("%d",&m);
 printf("enter the second element");
 scanf("%d",&n);
 for(i=1;i<=m;i++)
 {
  if(m%i==0&&n%i==0)
  {
   g=i;
  }
 }
 printf("%d",g);
}

PASCAL'S TRIANGLE CODE USING C LANGUAGE


#include<stdio.h>
void main()
{
 int n,i,j,a[30][30];
 printf("enter the number of line");
 scanf("%d",&n);
 for(i=0;i<=n;i++)
 {
  for(j=0;j<=i;j++)
  {
   if(j==0||i==j)
   {
    a[i][j]=1;
   }
   else
   {
    a[i][j]=a[i-1][j]+a[i-1][j-1];
   }
  }
 }
 for(i=0;i<n;i++)
 {
  for(j=0;j<(n-i-1);j++)
  {
   printf(" ");
  }
  for(j=0;j<=i;j++)
  {
   printf("%d",a[i][j]);
  }
  printf("\n");
 }
}

FLOY'D TRINAGLE CODE IN C LANGUAGE





#include<stdio.h>
void main()
{
                int i,j,k,l,n;
                printf("enter the total number of line");
                scanf("%d",&n);
                l=1;
                for(i=1;i<=n;i++)
                {
                                for(j=1;j<=(n-i);j++)
                                {
                                                printf(" ");
                                }
                                for(k=1;k<=i;k++)
                                {
                                                printf("%d ",l++);
                                }
                                printf("\n");
                }
}

Tuesday, February 19, 2019

Get input using inputbox, and then check it is positive or negative or zero in vb6,print using msgbox (visual basic)


Private Sub Form_Load()
Dim a As Integer
a = Int(InputBox("enter a number"))
If a = 0 Then
MsgBox (a & "is zero")
ElseIf a > 0 Then
MsgBox (a & "is positive")
Else
MsgBox (a & "is nagetive")
End If
 End Sub

Get input using inputbox, and then sum of digits (2digit) and display using msgbox in vb6(visual basic)


Private Sub Form_Load()
Dim a, b, c As Integer
a = Int(InputBox("enter a number"))
b = a Mod 10
c = a \ 10
d = b + c
MsgBox (d)
End Sub

Get input using inputbox, and then sum of two numbers and print using msgbox in vb6(visual basic)

Private Sub Form_Load()
Dim a, b, c As Integer
a = Int(InputBox("enter a number"))
b = Int(InputBox("enter a number"))
c = a + b
MsgBox (c)
End Sub