Saturday, 27 December 2014

How to Install Eclipse on Ubuntu

Eclipse comes with many flavors (See "Eclipse Packages" @ https://www.eclipse.org/downloads/compare.php?release=luna):
  • To use Eclipse for Java programming, choose "Eclipse IDE for Java Developers" or "Eclipse IDE for Java EE Developers". You need to first install JDK. Read "How to install JDK on Ubuntu".
  • To use Eclipse for PHP programming, choose "Eclipse IDE for PHP Developers".
  • To use Eclipse for C/C++ programming, choose "Eclipse IDE for C/C++ Developers".
  • Nonetheless, you can install any package, and then add more features.
To install Eclipse (e.g, for Java Programming):
  1. Download Eclipse from http://www.eclipse.org/downloads/. Choose "Linux" 32-bit or 64-bit ⇒ "Eclipse IDE for Java Developers" (or "Eclipse Standard|Classic") for Java SE program development; or "Eclipse IDE for Java EE Developers" for developing webapps. You will receive a TAR file (e.g., "eclipse-jee-luna-R-linux-gtk-x86_64.tar.gz") in the "~/Downloads" folder.
  2. Install:
    // Unzip the tarball into /usr/local
    $ cd /usr/local
    $ sudo tar xzvf ~/Downloads/eclipse-jee-luna-R-linux-gtk-x86_64.tar.gz
          // Extract the downloaded package
          // x: extract, z: for unzipping gz, v: verbose, f: filename
          // You can also unzip in "File Explorer" by double-clicking the tarball.
     
    // Change ownership
    $ cd /usr/local
    $ sudo chown -R your-username:your-groupname eclipse
          // Change ownership to your chosen username and groupname
          // -R recursive
     
    // Set up a symlink
    $ cd /usr/bin
    $ sudo ln -s /usr/local/eclipse/eclipse
          // Make a symlink in /usr/bin, which is in the PATH.
    $ ls -ld eclipse
    lrwxrwxrwx 1 root root 26 Aug 30 11:53 eclipse -> /usr/local/eclipse/eclipse
    $ which eclipse
    /usr/bin/eclipse
    $ whereis eclipse
    eclipse: /usr/bin/eclipse /usr/bin/X11/eclipse /usr/local/eclipse
To run Eclipse, open the "/usr/local/eclipse" folder and click on the "Eclipse" icon; or start a "Terminal", enter "eclipse".
Pin Eclipse on Launcher
To pin Eclipse on the launcher, create a /usr/share/applications/eclipse.desktop file with the following contents:
[Desktop Entry]
Name=Eclipse 
Type=Application
Exec=eclipse
Terminal=false
Icon=/usr/local/eclipse/icon.xpm
Comment=Integrated Development Environment
NoDisplay=false
Categories=Development;IDE;
Name[en]=Eclipse
Start Eclipse, right-click on the Eclipse icon on launcher ⇒ lock to launcher.

How to Install JDK 8 on Ubuntu

There are several JDK implementations available for Linux, such as Oracle JDK, OpenJDK, Sun JDK, IBM JDK and GNU Java Compiler. We shall choose the Oracle JDK 8. Ubuntu chooses OpenJDK as its default JDK, which is not 100% compatible with Oracle JDK.
Step 0: Check if JDK has already been Installed
Open a Terminal and issue this command:
 
$ javac -version
 
If a JDK version number (e.g., "javac 1.x.x_xx") appears, JDK has already been installed. You can skip the installation and goto step 2.
To remove OpenJDK, issue command:
$ sudo apt-get purge openjdk-\*
Step 1: Download and Install JDK
  1. Goto JDK (Java SE) download site @ http://www.oracle.com/technetwork/java/javase/downloads/index.html. Select "Java SE 8u{xx}" ⇒ JDK ⇒ Download ⇒ "Accept License Agreement" ⇒ Select Linux x86 (for 32-bit system) or Linux x64 (for 64-bit system) "tar.gz" package, e.g., "jdk-8u{xx}-linux-i586.tar.gz". (To check your OS version, goto "Settings" ⇒ "Details"; or issue command "file /sbin/init".) The tarball will be stored in folder "~/Downloads", by default.
  2. We shall install JDK under "/usr/local/java" (or Ubuntu's default JDK directory /usr/lib/jvm). First, create a directory "java" under "/usr/local". Open a Terminal and issue these commands:
    $ cd /usr/local
    $ sudo mkdir java
    Extract the downloaded package (Check your downloaded filename!)
    $ cd /usr/local/java
    $ sudo tar xzvf ~/Downloads/jdk-8u{xx}-linux-x64.tar.gz
           // x: extract, z: for unzipping gz, v: verbose, f: filename
    JDK shall be extracted in a folder "/usr/local/java/jdk1.8.0_{xx}", where {xx} is the upgrade number.
  3. Inform the Ubuntu to use this JDK/JRE:
    // Setup the location of java, javac and javaws
    $ sudo update-alternatives --install "/usr/bin/java" "java" "/usr/local/java/jdk1.8.0_{xx}/jre/bin/java" 1
          // --install symlink name path priority
    $ sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/local/java/jdk1.8.0_{xx}/bin/javac" 1
    $ sudo update-alternatives --install "/usr/bin/javaws" "javaws" "/usr/local/java/jdk1.8.0_{xx}/jre/bin/javaws" 1
     
    // Use this Oracle JDK/JRE as the default
    $ sudo update-alternatives --set java /usr/local/java/jdk1.8.0_{xx}/jre/bin/java
          // --set name path
    $ sudo update-alternatives --set javac /usr/local/java/jdk1.8.0_{xx}/bin/javac
    $ sudo update-alternatives --set javaws /usr/local/java/jdk1.8.0_{xx}/jre/bin/javaws
    The above steps set up symlinks java, javac, javaws at /usr/bin (which is in the PATH), that link to /etc/alternatives and then to JDK bin directory.
    The "alternatives" system aims to resolve the situation where several programs fulfilling the same function (e.g., different version of JDKs). It sets up symlinks thru /etc/alternatives to refer to the actual programs to be used.
    $ cd /usr/bin
    $ ls -ld java*
    lrwxrwxrwx 1 root root 22 Mar 31 20:41 java -> /etc/alternatives/java
    lrwxrwxrwx 1 root root 23 Mar 31 20:42 javac -> /etc/alternatives/javac
    lrwxrwxrwx 1 root root 24 Mar 31 20:42 javaws -> /etc/alternatives/javaws
     
    $ cd /etc/alternatives
    $ ls -ld java*
    lrwxrwxrwx 1 root root 40 Aug 29 18:18 java -> /usr/local/java/jdk1.8.0_20/jre/bin/java
    lrwxrwxrwx 1 root root 37 Aug 29 18:18 javac -> /usr/local/java/jdk1.8.0_20/bin/javac
    lrwxrwxrwx 1 root root 42 Aug 29 18:19 javaws -> /usr/local/java/jdk1.8.0_20/jre/bin/javaws
  4. To verify the JDK installation, issue these commands:
    // Show the Java Compiler (javac) version
    $ javac -version
    javac 1.8.0_20
     
    // Show the Java Runtime (java) version
    $ java -version
    java version "1.8.0_20"
    Java(TM) SE Runtime Environment (build 1.8.0_20-b26)
    Java HotSpot(TM) 64-Bit Server VM (build 25.20-b23, mixed mode)
     
    // Show the location of javac and java
    $ which javac
    /usr/bin/javac
    $ which java
    /usr/bin/java
  5. To use Java under Firefox, you need to enable the so-called "Java Plugin for web browser".
    $ cd /usr/lib/mozilla/plugins
    // if this directory does not exist, create it
    $ sudo mkdir -p /usr/lib/mozilla/plugins
    Then, create a symbolic link to your Mozilla plugins folder, (check your JDK folder)
    $ cd /usr/lib/mozilla/plugins
    $ sudo ln -s /usr/local/java/jdk1.8.0_{xx}/jre/lib/amd64/libnpjp2.so
    To verify the installation, restart your Firefox and issue URL "about:plugins".Check for Java plugins with the correct version.
    Starting from JDK 1.8u??, to run unsigned applets, you need to set security level to "high" add the sites to the "Exception List" (under the Java Control Panel ⇒ Security). To start the Java Control Panel:
    $ cd /usr/local/java/jdk1.8.0_{xx}/jre/bin
    $ ./ControlPanel      // OR ./jcontrol
    
    You need to restart Firefox after modifying the Exception List.
  6. [Don't Do this step - taken care by "alternative" in Step 3. Keep here to show you how to set PATH.] Add JDK's binary directory ("bin") to the "PATH" by editing "/etc/profile":
    $ cd /etc
    $ gksudo gedit profile   // OR "sudo nano profile" to use the console-based nano editor
    Add these lines at the end of the file "/etc/profile", replace "{xx}" with the actual number:
    export JAVA_HOME=/usr/local/java/jdk1.8.0_{xx}
    export PATH=$JAVA_HOME/bin:$PATH
    Rerun the configuration file by:
    $ source /etc/profile
     
    // Check the new settings for JAVA_HOME and PATH
    $ echo $JAVA_HOME
    /usr/local/java/jdk1.8.0_{xx}
     
    $ echo $PATH
    .....:/usr/local/java/jdk1.8.0_{xx}/bin
Step 2: Compile and Run a Hello-world Java Program
  1. Open "Folder" and create a new directory called "myProject" under your home directory to keep all your works.
  2. Open "Text Editor" (gedit). Enter the following source code and save as "Hello.java" under the "~/myProject" directory created earlier.
    public class Hello {   // To save as "Hello.java" under "~/myProject"
       public static void main(String[] args) {
          System.out.println("Hello, world from Ubuntu!");
       }
    }
  3. To compile the Hello-world Java program, launch a Terminal and issue these commands:
    // Change directory to where the source code resides
    $ cd ~/myProject
     
    // List the contents of current directory. Check for "Hello.java"
    $ ls
    ...... Hello.java ....
     
    // Compile "Hello.java" into "Hello.class"
    $ javac Hello.java
     
    // Check for "Hello.class"
    $ ls
    ...... Hello.class ....
     
  4. Run the Hello-world Java program:
    // Run "Hello.class"
    $ java Hello
    Hello, world from Ubuntu!


Saturday, 25 October 2014

DELD SOLUTIONS PDF FREE DOWNLOAD

HERE IS LINK TO DOWNLOAD DELD SOLUTION FREE OF COST

TYPICAL QUESTIONS & ANSWERS CONSIST OF DIFFERENT PART LIKE

1.OBJECTIVES QUESTIONS
2.NUMERICALS
3.DESCRIPTIVES

WHICH MAY HELPFUL FOR EXAMS !

DOWNLOAD DELD SOLUTIONS FROM HERE

https://drive.google.com/file/d/0BzbuE6BfgoRbUXJ4NjdxcUg0WG8/view?usp=sharing
 

Monday, 6 October 2014

VHDL Assignments of DELD

All VHDL Program source code

https://drive.google.com/file/d/0BzbuE6BfgoRbdUdqZUxMbTkxeTA/view?usp=sharing


ModelSim 5.5e Portable

ModelSim 5.5e portable simulator to run VHDL Programs


After Downloading extract the compressed file anywhere you want then goto win32 folder and run modelsim.exe


Download ModelSim 5.5e 

https://drive.google.com/file/d/0BzbuE6BfgoRbdUtud3FoN1VuZ0U/view?usp=sharing

Steps To Execute VHDL program in ModelSim


1. Write program
Goto file>new>source>vhdl

2. New window will appear then type code and save it on desktop (recommended)

Thursday, 2 October 2014

Wednesday, 1 October 2014

Download ModelSim

Download ModelSim 6.2c including Keygen

http://www.4shared.com/rar/GHu-fPQF/ModelSimSEv62c_incl_Keygen.html?locale=en

Note: on next page Click on Download button not on priority download. 

Saturday, 27 September 2014

How to install eclipse in ubuntu 12.04

Eclipse installation in ubuntu 12.04 is very simple . you can install eclipse using “software center” but you may not get the latest version, better download the latest version and install manually . Here we can see how to install eclipse in ubuntu manually .
install eclipse ubuntu 12.04

Installing eclipse in ubuntu 12.04

Step 1 » Before installing eclipse you need to install java , you can either install JRE or JDK .
krizna@leela:~$ sudo apt-get install openjdk-7-jre
[or]
If you are going to use eclipse for java development, then you can install JDK
krizna@leela:~$ sudo apt-get install openjdk-7-jdk
Step 2 » Download the latest eclipse package from here http://www.eclipse.org/downloads/?osType=linux
Step 3 » move the package to the /opt directory
krizna@leela:~$ sudo mv eclipse-SDK-4.2.2-linux-gtk.tar.gz /opt/
Step 4 » Unzip the package by typing the below command
krizna@leela:~$ cd /opt
krizna@leela /opt:~$ sudo tar -xvf eclipse-SDK-4.2.2-linux-gtk.tar.gz
Step 5 » Create a new desktop file eclipse.desktop in /usr/share/applications/ and add the below lines .
Step 6 » Now goto /usr/share/applications and find eclipse.desktop file for launching eclipse , you can drag this file to the launcher.
install eclipse ubuntu 12.04

All PL Assignments

Download All PL Assignments

https://drive.google.com/folderview?id=0BzbuE6BfgoRbcng1UVk1UlFpUkk&usp=sharing


PL Assignment 11 : Doubly Linked List


1:  /*  
2:   ==============================================================  
3:   Name    : Doubly Linked List  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #include<stdlib.h>  
12:  typedef struct dnode  
13:  {  
14:       int data;  
15:       struct dnode *next,*prev;  
16:  }dnode;  
17:  dnode *creat();  
18:  dnode *insert_b(dnode *head,char x);  
19:  dnode *insert_e(dnode *head,char x);  
20:  dnode *insert_m(dnode *head,char x);  
21:  dnode *delete_b(dnode *head);  
22:  dnode *delete_e(dnode *head);  
23:  dnode *delete_m(dnode *head);  
24:  void displayforward(dnode *head);  
25:  void displaybackward(dnode *head);  
26:  void main()  
27:  {  
28:       int m,n,choice;  
29:       char x;  
30:       dnode *head;  
31:       //clrscr();  
32:       head=creat();  
33:       displayforward(head);  
34:       do  
35:       {  
36:            printf("\n_________________________________________________________\n");  
37:            printf("1. Insert\n2. Delete\n3. Display Forward\n4. Display Backward\n");  
38:            printf("Enter Your choice: ");  
39:            scanf("%d",&n);  
40:            printf("\n");  
41:            switch(n)  
42:            {  

PL Assignment 10 : Polynomial


1:  /*  
2:   ==============================================================  
3:   Name    : Polynomial Using CLL  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #include<stdlib.h>  
12:  struct node  
13:  {  
14:       float coef;  
15:       int expo;  
16:       struct node *next;  
17:  };  
18:  struct node *create(struct node *);  
19:  struct node *insert_s(struct node *,float,int);  
20:  struct node *insert(struct node *,float,int);  
21:  void display(struct node *ptr);  
22:  void poly_add(struct node *,struct node *);  
23:  void poly_mult(struct node *,struct node *);  
24:  int main( )  
25:  {  
26:       int op;  
27:       struct node *start1=NULL,*start2=NULL;  
28:  do{  
29:       printf("1.Create\n2.Display\n3.Addition\n4.Multiplication\n5.Exit\nEnter Option : ");  
30:       scanf("%d",&op);  
31:       switch(op)  
32:       {  
33:       case 1:  
34:         printf("Enter polynomial 1 :\n");  
35:            start1=create(start1);  
36:            printf("Enter polynomial 2 :\n");  
37:            start2=create(start2);  
38:            printf("\nPolynomial 1 is : ");  
39:            display(start1);  
40:            printf("\nPolynomial 2 is : ");  
41:            display(start2);  
42:            break;  
43:       case 2:  
44:            printf("\nPolynomial 1 is : ");  
45:            display(start1);  
46:            printf("\nPolynomial 2 is : ");  
47:            display(start2);  
48:            break;  
49:       case 3:  
50:            poly_add(start1, start2);  
51:            break;  
52:       case 4:  
53:            poly_mult(start1, start2);  
54:            break;  
55:       case 5:  
56:            exit(0);  

PL Assignment 9 : Singly Linked List


1:  /*  
2:   ==============================================================  
3:   Name    : Singly Linked List  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #include<stdlib.h>  
12:  struct node  
13:  {     int data;  
14:       struct node *link;  
15:  };  
16:  void display(struct node *);  
17:  void add(struct node **,int);  
18:  void addn(struct node **,int,int);  
19:  void delete(struct node**,int);  
20:  void reverse(struct node *);  
21:  struct node *rreverse(struct node *head);  
22:  int main(void)  
23:  {     struct node *p=NULL;  
24:       int n,n1,n2;  
25:       do  
26:       {     printf("\n1.Add element\n2.Add at a particular location\n3.delete an element\n4.print the list\n5.print list reverse\n6.print reverse(recursion)\nenter your choice");  
27:            scanf("%d",&n);  
28:            switch(n)  
29:            {     case 1:  
30:                 {     printf("\nenter element");  
31:                      scanf("%d",&n1);  
32:                      add(&p,n1);  
33:                 }break;  
34:                 case 2:  
35:                 {     printf("\nenter element");  
36:                      scanf("%d",&n1);  
37:                      printf("\nat what location do you want to add?");  
38:                      scanf("%d",&n2);  
39:                      addn(&p,n1,n2);  
40:                 }break;  
41:                 case 3:  
42:                 {     printf("\nenter element");  
43:                      scanf("%d",&n1);  
44:                      delete(&p,n1);  
45:                 }break;  

PL Assignment 8 : Sparse Matrix


1:  /*  
2:   ==============================================================  
3:   Name    : Sparse Matrix   
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #define MAX 30  
12:  void creat(int a[10][10],int m,int n);  
13:  void sparse(int a[10][10],int m,int n,int b[MAX][3]);  
14:  void print(int b[MAX][3]);  
15:  void addition(int b1[MAX][3],int b2[MAX][3],int b3[MAX][3]);  
16:  void transpose(int [][3],int [][3]);  
17:  void fast_transpose(int [MAX][3],int [MAX][3]);  
18:  void main()  
19:  {  
20:     int a[10][10],b1[MAX][3],b2[MAX][3],b3[MAX][3];  
21:     int m1,n1,m2,n2,choice,op;  
22:     printf("Enter First Matrix:");  
23:     printf("\nEnter number of rows and column:\n");  
24:     scanf("%d%d",&m1,&n1);  
25:     creat(a,m1,n1);  
26:     sparse(a,m1,n1,b1);  
27:     printf("\n\nEnter Second Matrix:");  
28:     printf("\nEnter number of rows and column:\n");  
29:     scanf("%d%d",&m2,&n2);  
30:     creat(a,m2,n2);  
31:     sparse(a,m2,n2,b2);  
32:     printf("\nYour First Sparse Matrix:");  
33:     print(b1);  
34:     printf("\n\nYour Second Sparse Matrix:");  
35:     print(b2);  
36:     do  
37:     {  
38:        printf("\n_______________________________________________________");  
39:        printf("\nChoose the operation which do you want to perform: ");  
40:        printf("\n 1.Addition\n 2.Simple Transpose\n 3.Fast Transpose\n");  
41:        printf("Your choice is: ");  
42:        scanf("%d",&choice);  
43:        switch(choice)  
44:        {  
45:        case 1:  
46:             if(m1==m2 && n1==n2)  
47:             {  
48:               printf("\nAddition of Sparse Matrix:\n");  
49:               addition(b1,b2,b3);  
50:               print(b3);  
51:             }  

PL Assignment 7 : Quick sort recursively


1:  /*  
2:   ==============================================================  
3:   Name    : Mobile Information  
4:   Author   : Shivkumar, Mujahid  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #include<string.h>  
12:  typedef struct mobile  
13:  {  
14:    char mobile_no[11];  
15:    int bal;  
16:    char name[20];  
17:  }mobile;  
18:  void creat(mobile st[],int n);  
19:  void insert(mobile st[],int position,int n);  
20:  void del(mobile st[],int position,int n);  
21:  int search(mobile st[],char mobile_no[],int n);  
22:  void print(mobile st[],int n);  
23:  void sort_bal(mobile st[],int n);  
24:  void sort_name(mobile st[],int n);  
25:  void modify(mobile st[],int n);  
26:  /*---- Main Function ----*/  
27:  void main()  
28:  {  
29:    mobile st[20];  
30:    int n,position,choice,count;  
31:    char mobile_no[15];  
32:    printf("\nEnter number of mobile: ");  
33:    scanf("%d",&n);  
34:    creat(st,n);  
35:    print(st,n);  
36:    do  
37:    {  
38:     printf("--------------------------------------------------------------");  
39:     printf("\nChoose the operation which do you want to perform: ");  
40:     printf("\n 1.Insert\n 2.Print\n 3.Delete\n 4.Search\n 5.Sort By bal(Descending Order)\n ");  
41:     printf("6.Sort By Name(Ascending Order)\n 7.Modify\n");  
42:     printf("Your choice is: ");  
43:     scanf("%d",&choice);  
44:     switch(choice)  
45:     {  
46:      case 1:  

PL Assignment 6 : Searching and Sorting of students information


1:  /*  
2:   ==============================================================  
3:   Name    : Student Information  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdlib.h>  
11:  #include<string.h>  
12:  #include<stdio.h>  
13:  #include<ctype.h>  
14:  #include<math.h>  
15:  typedef struct student  
16:  {     char name[30];  
17:       int roll_no;  
18:       long long int mob;  
19:       char address[100];  
20:  }stud;  
21:  void ip(stud *,int);  
22:  void sort_asc(stud *,int);  
23:  void sort_ascn(stud *,int);  
24:  void sort_des(stud *,int);  
25:  void print(stud *,int);  
26:  void swap(stud *,stud *);  
27:  void search(stud *,int,int);  
28:  int main(void)  
29:  {     int n,i,j;  
30:       printf("How many records will you enter?");  
31:       scanf("%d",&n);  
32:       if(n<=0)  
33:       {     printf("\nenter valid numbers!");  
34:            exit(0);  
35:       }  
36:       stud *s=(stud *)malloc(n*sizeof(stud)),*s1,*s2;  
37:       ip(s,n);  
38:       do  
39:       {     printf("\n1.Sort in ascending order\n2.Sort in descending order\n3.Search\nEnter your choice");  
40:            scanf("%d",&j);  
41:            switch(j)  
42:            {     case 1:  
43:                 {     s1=s;  
44:                      sort_asc(s1,n);  
45:                      //print(s1,n);  
46:                 }break;  

PL Assignment 5 : File operations using command line argument


1:  /*  
2:   ==============================================================  
3:   Name    : File Operations  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ===========================================================  
9:   */  
10:  #include<stdio.h>  
11:  #include<stdlib.h>  
12:  void filecpy(char *,char *);  
13:  int main(int argc, char *argv[])  
14:  {  
15:       if(argc!=3)  
16:       {     printf("invalid number of arguments");  
17:            exit(0);  
18:       }  
19:       filecpy(argv[1],argv[2]);  
20:       return 0;  
21:  }  
22:  void filecpy(char *p,char *q)  
23:  {     FILE *f1,*f2;  
24:       char c[200];  
25:       f1=fopen(p,"r");  
26:       f2=fopen(q,"w");  
27:       if(f1==NULL)  
28:       {     printf("no such file");  
29:            exit(0);  
30:       }  
31:       while(fgets(c,200,f1)!=NULL)  
32:            fputs(c,f2);  
33:       fclose(f1);  
34:       fclose(f2);  
35:  }  

PL Assignment 4 : Array of structure


1:  /*  
2:   ============================================================================  
3:   Name    : Array Of Structure  
4:   Author   : Mujahid, Shivkumar  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ============================================================================  
9:   */  
10:  #include <stdio.h>  
11:  #include <stdlib.h>  
12:  #define max 10  
13:  typedef struct  
14:  {  
15:       char name[30];  
16:       int rollno;  
17:       char mobno[10];  
18:  }student;  
19:  int getdata(student *s)  
20:       {  
21:       int i,n;  
22:       printf("Enter the number of students : \n");  
23:       scanf("%d",&n);  
24:       for(i=0;i<n;i++)  
25:       {  
26:            printf("Enter name : \n");  
27:            scanf("%s",&(s+i)->name);  
28:            (s+i)->rollno=valid_roll(s,i);  
29:            valid_mob(s,i);  
30:       }  
31:       return i;  
32:  }  
33:       int valid_roll(student *s,int n)  
34:       {  
35:            int i,roll;  
36:            printf("Enter roll number\n");  
37:            scanf("%d",&roll);  
38:            if(roll<0)  
39:            {  

PL Assignment 3 : String Operations


1:  /*  
2:   ============================================================================  
3:   Name    : String Operations  
4:   Authors   : Shivkumar, Mujahid  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ============================================================================  
9:   */  
10:  #include <stdio.h>  
11:  #define max 10  
12:  int length(char*);  
13:  void copy(char*,char*);  
14:  int palindrome(char*);  
15:  void reverse(char*);  
16:  int compare(char*,char*);  
17:  void concat(char*,char*);  
18:  void substr(char*,char*);  
19:  int main()  
20:  {  
21:       char s1[max],s2[max];  
22:       char *str1,*str2;  
23:       int ch,len,comp,temp,i;  
24:       do  
25:       {  
26:            printf("\nMENU\n");  
27:            printf("1. Length of String\n");  
28:            printf("2. Copy\n");  
29:            printf("3. Palindrome\n");  
30:            printf("4. Reverse\n");  
31:            printf("5. Compare\n");  
32:            printf("6. Concatenate\n");  
33:            printf("7. Substring\n");  
34:            printf("0. Exit\n");  
35:            printf("\nEnter choice :\n");  
36:            scanf("%d",&ch);  
37:            printf("Enter String :\n");  
38:            scanf("%s",&s1);  
39:            str1=s1;     //Assigns value to str1 of s1;  
40:            printf("Entered String : %s",s1);  
41:            switch(ch)  
42:            {  
43:            case 1:     len=length(str1);  
44:                      printf("\nLength of String : %d\n",len);  
45:                      break;  
46:            case 2:     printf("\nCopy :\n");  
47:                      copy(str2,str1);  
48:                      printf("\nCopied String : %s",str2);  
49:                      break;  
50:            case 3: temp=palindrome(str1);  
51:                      if(temp==1)  
52:                           printf("\n%s is not a Palindrome",str1);  
53:                      else  
54:                           printf("\n%s is a Palindrome",str1);  
55:                      break;  
56:            case 4: reverse(str1);  
57:                      printf("\nReversed String : %s",str1);  
58:                      reverse(str1);//For getting the original string back  
59:                      break;  
60:            case 5: printf("\nEnter second string :\n");  
61:                      scanf("%s",&s2);  
62:                      str2=s2;     //Assigning Char value to Pointer  
63:                      printf("\nEntered String : %s",str2);  
64:                      comp=compare(str1,str2);  
65:                      if(comp==0)  

PL Assignment 2 : Matrix Operations


1:  /*  
2:   ============================================================================  
3:   Name    : Matrix Operations  
4:   Authors   : Shivkumar, Mujahid  
5:   Version   :  
6:   Copyright  : Your copyright notice  
7:   Description : Hello World in C, Ansi-style  
8:   ============================================================================  
9:   */  
10:  int *input(int **mat,int *row,int *col)  
11:  {  
12:       int i,j;  
13:       printf("\nEnter Number of Rows and columns :\n");  
14:       scanf("%d%d",row,col);  
15:       mat=malloc(*row * sizeof(int*));  
16:       for(i=0;i<*row;i++)  
17:       {  
18:            mat[i]=malloc(*col * sizeof(int*)); //While using malloc use m[i] instead of *(m+i)  
19:            if(mat[i]==0)//While using malloc use m[i] instead of *(m+i)  
20:            {  
21:                 printf("\nMemory can not be alloted.\n");  
22:                 return 0;  
23:            }  
24:       }  
25:       printf("\nEnter Elements :\n");  
26:       for(i=0;i<*row;i++)  
27:            for(j=0;j<*col;j++)  
28:            {  
29:                 scanf("%d",(*(mat+i)+j));  
30:                 //     printf("%d\n",*(*(mat+i)+j));  
31:            }  
32:       return(mat);  
33:  }  
34:  void display(int **mat,int row,int col)  
35:  {  
36:        int i,j;  
37:       printf("\nMatrix :");  
38:       printf("\nRow : %d Col : %d",row,col);  
39:       for(i=0;i<row;i++)  
40:       {  
41:            printf("\n");  
42:            for(j=0;j<col;j++)  
43:                 printf(" %d ",*(*(mat+i)+j));  
44:       }  

PL Assignment 1 : Set Operations Using Array


1:  /* 
2:   * Title : Set Operations Using Array 
3:   * 
4:   * Author : Shivkumar, Mujahid 
5:   * 
6:   */ 
7:  #include<stdio.h> 
8:  int uni(int a[10],int b[10],int k,int l); 
9:  int inter(int a[10],int b[10],int k,int l); 
10:  int diff(int a[10],int b[10],int k,int l); 
11:  int symdiff(int a[10],int b[10],int k,int l); 
12:  /*----- Main Function -----*/ 
13:  int main() 
14:  { 
15:    int a[10],b[10],i,j,k,l,choice,count; 
16:    printf("Enter number of elements in set A: ",k); 
17:    scanf("%d",&k); 
18:    printf("Enter elements in set A: "); 
19:    printf("\n"); 
20:    for(i=0;i<k;i++) 
21:    scanf("%d",&a[i]); 
22:    printf("\nEnter number of elements in set B: ",l); 
23:    scanf("%d",&l); 
24:    printf("Enter elements in first set B:"); 
25:    printf("\n"); 
26:    for(i=0;i<l;i++) 
27:    scanf("%d",&b[i]); 
28:    do 
29:    { 
30:     printf("\n---------------------------------------------------------------"); 
31:     printf("\nChoose the operation which you want to perform:"); 
32:     printf("\n 1.Union\n 2.Intersection\n 3.Difference\n 4.Symmetric difference\n 5.Exit",choice); 
33:     printf("\nYour choice is: "); 
34:     scanf("%d",&choice); 
35:     printf("\n\n"); 
36:     switch(choice) 

Ads Inside Post