WELCOME TO GTU MATERIAL

GTU MATERIAL PROVIDE YOU ALL TYPE OF EDUCATION MATERIAL | DOWNLOAD FREE MATERIAL | ALL TYPE OF EDUCATION SOFTWARES | EXAM ALERTS | EBOOKS | EXAM PAPERS | TIME TABLE | ALL TYPE OF SYLLABUS | MBA | MCA | ENGINEERING | BE | FREE MATERIAL PROVEDE

SHARE YOUR MATERIAL ALSO.. PLEASE SEND ME YOUR MATERIAL WHO SHARE WITH PEOPLE WE PUBLISH IN GTU MATERIAL WITH YOU NAME.. PLEASE SEND US YOUR NAME, COLLEGE NAME, AND STREAM SO THAT WE CAN PUBLISH WITH YOUR NAME..

THANKS YOU SO MUCH.....

Monday 29 November 2010

Assignment – 8 Regular Language & Finite Automata

MCA Semester – II
Subject: 620007 – Theory of Computation

Assignment – 8
Regular Language & Finite Automata




1
Regular Language
2
Regular Expression
3
Regular Language & Regular Expression Over Σ
4
Finite Automata / Finite State Machine / DFA
5
Transition Table
6
Types of State
7
Transition Diagram
8
Transition Function ( δ )
9
Extended Transition Function ( δ* )
10
String Accepted by FA
11
String Rejected by FA
12
Regular Language ( In Context of  FA)
13
Distinguishable String With Respect To Language




Note: Write all Answers with Example.

Theory Of Computation | Assignment – Nondeterminism and Kleene’s Theorem

MCA Semester – II
Subject: 620007 – Theory of Computation
Assignment – 9
Nondeterminism and Kleene’s Theorem



1
Nondeterministic Finite Automata
2
Non-Recursive Definition of δ* for an NFA
3
Recursive Definition of  δ* for an NFA
4
Acceptance by an NFA
5
NFA with Λ – Transition (NFA–Λ)
6
Non-Recursive Definition of δ* for an NFA – Λ
7
Λ – Closure of a Set of States
8
Recursive Definition of  δ* for an NFA – Λ
9
Statement & Application of Kleene’s Theorem - I
10
Statement & Application of Kleene’s Theorem - II
11
Relationship Between DFA and NFA
12
DFA Vs. NFA



Note: Write all Answers with Example.

Theory Of Computation | Assignment –Context Free Grammars

MCA Semester – II
Subject: 620007 – Theory of Computation
Assignment – 11
Context Free Grammars

1
Context Free Grammar ( CFG)
2
Context Free Language (CFL)
3
List out Applications of  Context Free Grammar ( CFG)
4
What is Meaning of Context Free?
5
Regular Grammar
6
Linear Grammar
7
Leftmost Derivation
8
Rightmost Derivation
9
What is Derivation Tree or Parse Tree?
10
An Ambiguous Grammar
11
Balanced Strings of Parentheses
12
Nullable Variables
13
Unit Production
14
Chomsky Normal Form (CNF)
15
Inherently Ambiguous
16
List out Steps to Convert CFG into CNF

Example of Finite Automata

MCA Semester - II
Subject: 620007 - Theory of Computation
Unit - II
Important Question

DFA for Language L1 and L2 are given as follow

Figure – I: DFA for Language L1

Figure – II: DFA for Language L2

       Find out. (a) L1 U L2, (b) L1 ∩ L2, (c) L1 – L2

Step-I

Common Diagram For All three Question



(a)   L1 U L2

-         In Figure - I ‘C’ is Final State and In Figure -II ‘Z’ is Final State, So All the State Containing Either ‘C’ or ‘Z’ becomes a Final State.
-         So, CY, AZ, BZ, and CZ become Final State.

Now, We can simplify the above figure as per follow.   

Final DFA which accept L1 U L2



(b)   L1 ∩ L2

- In Figure - I ‘C’ is Final State and In Figure -II ‘Z’ is Final State, So All the State Containing both ‘C’ AND ‘Z’ becomes a Final State.
- So, CZ becomes Final State.

Now, we can simplify the above figure as per follow.

Final DFA which accept L1 ∩ L2



(C) L1 – L2

- In Figure - I ‘C’ is Final State and In Figure -II ‘Z’ is Final State, So All the State Containing ‘C’ and Does Not Containing ‘Z’ becomes a Final State.
- So, CY becomes Final State.

Now, we can simplify the above figure as per follow.

Final DFA which accept L1 - L2     

GTU MCA 3rd SEMESTER | SOOADM ASSIGNEMENTS

Department of MCA
Semester – III
(1) What is System? Explain the types of System in brief.
(2) List and briefly define the seven phases of the systems development life cycle.
(3) Discuss the Roles & Qualities of System Analysts.
(4) Give the Differences:
(a) OAS vs. KWS
(b) MIS vs. DSS
(c) CSCWS vs. GDSS
(5) List the reasons for adopting CASE tools.
(6) List advantages of using Code Generation tools.
(7) List the advantages of using system analysis and design techniques.
(8) Discuss integrating technologies for systems.

Structured & Object Oriented Analysis & Design Methodology

Assignment – III

1. List advantages of using data flow approaches.
2. What is the difference between Logical DFD and Physical DFD?
3. Define Following terms
    (a) Event Response Table
    (b) Trigger
    (c) Base Element
    (d) Derived Element
    (e) Primitive Process
4. What is partitioning? List reasons for partitioning DFD.
5. Define the terms
    (a) Data Dictionary
    (b) Metadata
    (c) Data Repository
    (d) DTD
6. List need for understanding the Data Dictionary.
7. Explain with Example
   (a) Structured English
   (b) Decision Table
   (c) Decision Tree
8. Define Process Specification. List reasons for producing it.
9. What is horizontal balancing? Why it is desirable to balance each process?

Quick Review


Transaction Processing

Concurrency Control
Database Backup and Recovery

Database Security

Friday 26 November 2010

system software material | question bank | SS Importatnt Questions


Unit 1 :- Introduction to System Software and Software Tools
Chapter 1 :-  Language Processors
 Define the following terms.

  1. Program
  2. Software
  3. application software
  4. system software
  5. Application domain
  6. execution domain
  7. semantics
  8. semantic gap
  9. PL Domain
  10. specification gap
  11. execution gap,
  12. Language Processor
  13. Language Processing
  14. Source Program
  15. Target Program
  16. Source Language
  17. Target Language
  18. Language Translator
  19. Detranslator
  20. Preprocessor
  21. Language Migrator
  22. Interpreter
  23. Problem Oriented Languages



  1. Procedure Oriented Languages
  2. Lexical rules
  3. syntax rules
  4. semantic rules
  5. Forward Reference
  6. Language Processor Pass
  7. Intermediate Representation of Programs
  8. Formal Language
  9. Alphabet
  10. Terminal Symbol
  11. Meta Symbol
  12. String, Length
  13. Null String
  14. Concatenation
  15. Non Terminal Symbol
  16. Production
  17. Distinguished Symbol
  18. Grammar
  19. Binding
  20. Binding Times
  21. Static Binding
  22. Dynamic Binding






 Write an answer of following questions in detail.
  1. Describe that how Language Processing Activities arise and how it is represented using domains.
  2. Advantages of Introducing PL domain between application domain and execution domain.
  3. Describe a spectrum (entire) of Language Processor.
  4. Explain Language Processing Activity (Program Generation & Program Execution Activity) in detail.
  5. Explain the comparison of Translation model and Interpretation model in terms of Advantage and Disadvantage.
  6. Explain Forward Reference with example.
  7. Draw and Explain Front-End of a Toy Compiler with Lexical Analysis, Syntax Analysis semantic analysis.
  8. Draw and Explain Back-End of a Toy Compiler with memory allocation and code generation.
  9. Explain Derivation, Reduction and Parse Trees with example.
  10. Explain different types of Grammars (Type 0, Type 1, Type 2, Type 3, Operator Grammar).
  11. What is ambiguity in Grammatic specification and how we can remove it?
  12. Explain Two Language Processor Development Tool (LPDT) LEX and YACC with example.

DBMS - II ASSIGNMENT | Assignment Database Backup and Recovery



M.C.A. Semester - II
620006 – Databse Management System - II
Assignment – 3 (Database Backup and Recovery)
------------------------------------------------------------------------------------------------------------ 
Q-1. Explain the Following Questions in detail.

1). What is Database Backup? Why backup is needed? Explain Types of Database Backup?
2). Discuss different types of database failures that may occur in database environment?
3). What is Recovery? Explain types of Recovery? (Forward and Backward Recovery)
4). What is Log Based Recovery? Explain all Log based Recovery technique with Example?
5). What is Checkpoint? How is checkpoint information is used in recovery operation following System crash explain with example?
6). Describe Shadow Paging Recovery Technique? Under what circumstances does it 
not require a transaction log? List advantages and disadvantage of shadow paging?
7). What is Database Buffer? Explain Buffer Management technique used in database recovery?
8). Table : Transaction T1

Time shot
Transaction Step
Actions
Time-1
Read (A,a1)
Read current employee’s load balance.
Time-2
a1:= a1 – 500
Debit the Account by INR 500
Time-3
Write(A,a1)
Write the new loan balance
Time-4
Read (B,b1)
Read the current account payable balance
Time-5
b1 := b1 + 500
Credit the account balance by INR 500
Time-6
Write(B,b1)
Write the new balance
Time-7
Commit T1
Commit entire transaction

Consider the transaction as above Table to create log entries for immediate updates. Suppose, that a failure occurs just after the transaction log record for action Write(B,b1) has been Written.
a). Show the Contents of transaction log at the time of failure.
b). What action is necessary and Why?
c). What are the Resulting value of A and B?


9). Consider the transaction as above Table to create log entries for deferred updates. Suppose, that a failure occurs just after the record is written to the transaction log?
a). Show the Contents of transaction log at the time of failure.
b). What action is necessary and Why?
c). What are the Resulting value of A and B?


10).  Consider the following Transaction Step for Immediate Update Technique. 
Initial Value of A=1000, B=2000 and C=700.
         
Transaction Step
Actions
Begin Transaction T1
Start Transaction T1
            Read (A)
Read Value A
            A:= A – 50
Deduct 50 from A
            Write(A)
Write the new value of A
            Read (B)
Read the Value of B
            B := B + 50
Add 50 to B
            Write(B)
Write the new value of B
End Transaction
Commit entire transaction T1
Begin Transaction T2
Start Transaction T2
           Read (C)
Read Value of C
           C:=C-100
Deduct 100 from C
           Write (C)
Write the new value for C
End Transaction T2
Commit Entrire transaction T2

  • Create Log entries for Above transaction steps.
  • Let us Assume that the crash occurs just after the log record for step write(B) of transaction T1 then
    • What action is necessary and why?
    • What are the resulting value of A and B
  • Let us Assume that Crash comes just after the log record for the Wrtite(C) of Transaction T2 then
    • What action is necessary and Why?
    • What are the resulting value of A and B?
  • Finally, Let us Assume that Crash occurs just after the log record for Transaction T2,Commit
    • What action is necessary and Why?
    • What are the resulting value of A and B?  
11). Consider the following log entries.
Log Entries
T1,Start
T1,A,5000,4500
T1,Commit
Checkpoint
T2,Start
T2,B,1000,1050
T2,C,4000,3900
T2,Commit
T3,Start
T3,D,2500,2000
T4,Start
T4,E,1000,1200
T4,F,1200,1400

Suppose, that system crash is occurs after the last write entry of F of transaction T4 
then What action is necessary and why?        

----------------------------------------------------------------------------------------------------------------------------------------------
 Q-2. Differentiate the following :
1). Deferred Update Vs Immediate Update
2). Rollforward Vs Rollback
3). Stable Storage Vs Disk
4). Volatile Storage Vs Non-Volatile Storage
5). System Crash Vs Media Failure
-----------------------------------------------------------------------------------------------------------------------------------------------

Q-3. Answer the following in One line?
1) If the buffer pool is large enough that uncommited data are never forced to disk, is UNDO still necessary?
2) How about REDO?
3) If updates are always forced to disk when a transaction is performed, is UNDO still necessary?
4) How about REDO?
5) After a soft crash, where in the log should Analysis start?
------------------------------------------------------------------------------------------------------------

FOP MATERIAL | 100 - C language programms


‘C’ LANGUAGE PROGRAMMING PART

            PROG – 1   SIMPLE PROG TO DISPLAY YOUR NAME.

            #inlcude<stdio.h>
            #include<conio.h>
            void main()
{                     
            printf(“my name is chetan”);
            getch();
}         
           
            output : my name is chetan
           
            ------------------------------------------------------------------------------------------------------------------------------
            PROG 2 –TO FIND OUT THE REDIUS FOR CIRCLE

            #include <stdio.h>
#include <conio.h>
#define pi 3.14
void main()
{
            float r,a,cir;
            clrscr();
             printf(" Enter the Redius for circle");
            scanf("%f",&r);
             printf("\n\nArea of Circle is : %f",pi*r*r);
            printf("\n\n Circumference of the Circle is : %f",2*pi*r);
            getch();
}


OUTPUT : DEPEND ON THE VALUE YOU ENTER




PROG -3 /* Read an integer to sore hours & convert into days and hrs.*/

#include<stdio.h>
#include<conio.h>
void main()
{
int num,w,yr,d;
clrscr();
printf(" enter number: ");
scanf("%d",&num);
yr=num/365;
w=(num%365)/7;
d=(num%365)%7;
printf("\nYear is :=%d",yr);
printf("\nWeek is :=%d",w);
printf("\nDay is  := %d",d);
getch();
}
           
            OUTPUT : DEPENDS ON THE NUMBER YOU ENTER
            ------------------------------------------------------------------------------------------------------------------------------

PROG-  4 – TO FIND OUT TOTAL MARKS AND PERCENTAGE

#include<stdio.h>
#include<conio.h>
void main()
{
            int n1,n2,n3,n4,n5,tot,per;
            clrscr();
            printf("enter mark1  ");
            scanf("%d", &n1);
            printf("enter mark2  ");
            scanf("%d", &n2);
            printf("enter mark3  ");
            scanf("%d", &n3);
            printf("enter mark4  ");
            scanf("%d", &n4);
            printf("enter mark5  ");
            scanf("%d", &n5);
            tot=n1+n2+n3+n4+n5;
            per=tot/5;
            printf("the total marks from 500 is= %d", tot);
            printf("\n");
            printf("percent is= %d", per);
            getch();
}


output:
enter mark1  45
enter mark2  46
enter mark3  38
enter mark4  98
enter mark5  74
the total marks from 500 is= 301
percent is= 60
            ------------------------------------------------------------------------------------------------------------------------------

PROG-5 Prog for factorial recursion

#include<stdio.h>
#include<conio.h>
void main()

             {
            int res;
            res=rec(5);
            clrscr();
            printf("\n The fact recursion is  %d",res);
            getch();
            }
            int rec (int n)
            {
            int f=1;
            if (n==1)
            return(1);
            else
            f=n*rec(n-1);
            return (f);
             }

output:   The fact recursion is  120

------------------------------------------------------------------------------------------------------------------------------


Prog 6 prog for count salary

# include <stdio.h>
# include <conio.h>
void main()
{
            int bs,da,hra;
            clrscr();
            printf("Enter Basic Salary :");
            scanf("%d",&bs);
            if(bs<=1500)
            {
            da=bs*0.9;
            hra=bs*0.1;
            bs=bs+da+hra;
            }
            else if(bs>1500)
            {
            hra=500;
            da=bs*0.98;
            bs=bs+da+hra;
            }
            printf("TOTAL GROSS SALARY IS : %d",bs);
            getch();
}

output:
Enter Basic Salary :2000
TOTAL GROSS SALARY IS : 4459







Prog 7: prog for count persentage

#include<stdio.h>
#include<conio.h>
void main()
 {
            float n1,n2,n3;
            clrscr();

            printf("enter n1  ");
            scanf("%f", &n1);
            printf("enter n2  ");
            scanf("%f", &n2);
            printf("enter n3  ");
            scanf("%f", &n3);
            if (n1+n2>n3)
{
            printf("valid tringle");
}
            else if (n2+n3>n1)
            printf("valid tringle");
            else if(n3+n1>n2)
            printf("valid tringle");
            getch();
}


output
enter n1  3
enter n2  4
enter n3  5
valid tringle
------------------------------------------------------------------------------------------------------------------------------








Prog 8 :prog for leap year

 #include<stdio.h>
 #include<conio.h>
 void main()
 {

            int y,lp;
            clrscr();
            printf ("enter year   ");
 scanf("%d",&y);
            if (y%4==0)
{
            printf("leap year");
}         
            else
            printf("not leap year");
            getch();
}

output:
enter year   2004
leap year
------------------------------------------------------------------------------------------------------------------------------
                       
Prog 9 :TO FIND OUT MAXIMUM NUMBER

#include <stdio.h>
#include <conio.h>
            void main()
{
            int n1,n2,max;
            clrscr();
            printf("enter n1   ");
            scanf("%d", &n1);
            printf("enter n2   ");
            scanf("%d", &n2);
            if (n1 >= n2)
{
            max=n1;
            printf("the  max no is number %d",max);
}
            else
{
max=n2;
            printf("the max no is number %d", max);
}
            getch();
}


output:
enter n1   34
enter n2   32
the  max no is number 34
------------------------------------------------------------------------------------------------------------------------------

prog 10: prog for whether the number is odd or even.
           
# include <stdio.h>
# include <conio.h>
void main()
{
            int a;
            clrscr();
            printf("Enter no. :");
            scanf("%d",&a);
            if(a%2==0)
            {
            printf("no is even");
            }
            else
            {
            printf("no is odd");
            }
            getch();
}


OUTPUT : DEPEND ON THE NUMBER YOU ENTER


Prog11 : Prog to find total cost

#include<stdio.h>
#include<conio.h>
void main()
 {
            int qty;
            float price,cost,dis;
            clrscr();
            printf("enter qty   ");
            scanf("%d", &qty);
            printf("enter price   ");
            scanf("%f",&price);
            cost=price * qty;
            if (cost >= 1000)
{
dis= price * qty * 0.1;
            cost= (price*qty) - dis;
            printf("the total cost is  : %f", cost);
            }
            else
            {
            cost=price*qty;
            printf("%f", cost);
            }
            getch();
 }

OUTPUT : DEPEND ON THE QTY YOU ENTER
------------------------------------------------------------------------------------------------------------------------------

Prog 12 : This programme is to find middle value from given three values using  logical operators.

# include <stdio.h>
# include <conio.h>
main()
{
             int a,b,c;
             clrscr();
             printf("\n Enter the value of A : ");
             scanf("%d",&a);
             printf("\n Enter the value of B : ");
             scanf("%d",&b);
             printf("\n Enter the value of C : ");
             scanf("%d",&c);
             if (((a>b) && (a<c)) || ((a<b) && (a>c)))
            printf("\n Middle value is %d",a);
             if (((b>a) && (b<c)) || ((b<a) && (b>c)))
            printf("\n Middle value is %d",b);
             if (((c>a) && (c<b)) || ((c<a) && (c>b)))
            printf("\n Middle value is %d",c);
             getch();
             return 0;
}

OUTPUT : DIPLAY THE MIDDLE VALUE
------------------------------------------------------------------------------------------------------------------------------
PROG 13: TO FIND OUT SALARY + HRA +DA
#include<stdio.h>
#include<conio.h>
void main()
{
            int sal,da,hra;
            clrscr();
            printf("enter salary  ");
            scanf("%d",&sal);
            if (sal<=1500)
            {
            hra=sal*0.1;
            da= sal*0.9;
            }
            else
            {
            hra=500;
            da=sal*0.9;
            }
            printf("basic salary is = %d", sal,da,hra);
            printf("\n the total salary is = %d", sal+da+hra);
            getch();
}

OUTPUT : DISPLAY THE BASIC SALARY
Prog14 : prog  to count length of string

#include<stdio.h>
#include<conio.h>
void main()
            {         
     char arr[50];
            Int len1;
clrscr();
printf("enter the string  ",arr);
scanf("%s",arr);
gets(arr);
len1 = strlen (arr);
printf ("\n string = %s length = %d", arr,len1);
           getch();
           }

output:
enter the string  mayur
             string = mayur length = 5
            ------------------------------------------------------------------------------------------------------------------------------

prog 15 :prog for define capital,small or digit

#include<stdio.h>
#include<conio.h>
void main()
{
            char a;
            clrscr();
            printf ("enter any key   ");
            scanf ("%c", &a);
            if (a>=65 && a<=90)
{
            Printf("the result is capital alphbet %c", a);
}
            else if (a>=97 && a<=122)
            printf ("small alpha %c",a);
            else if (a>=48 && a<=57)
            printf ("digit %c",a);

            getch();
}

           
output
enter any key   G
the result is capital alphbet G
------------------------------------------------------------------------------------------------------------------------------

Prog 16 : prog for a counting string

#include<stdio.h>
#include<conio.h>
void main()
{
   char str[8];
   int j=0;
 strlen j();
              clrscr();
   printf("\n Enter the string   ");
   scanf("\n %s",str);
      j=strlen(str);
   printf("The length is %d",j);
               getch();
 }
           
 output
 Enter the string   abc
 The length is 3

------------------------------------------------------------------------------------------------------------------------------

Prog 17 : prog for whether the insurance is given or not
           
# include <stdio.h>
# include <conio.h>
# include <string.h>
void main()
{
            char st[6];
            char s[5];
            int a;
            clrscr();
            printf("Enter status: ");
            scanf("%s",&st);
            printf("Enter sex: ");
            scanf("%s",&s);
            printf("Enter age: ");
            scanf("%d",&a);
            if(strcmp(st,"u")==0 && strcmp(s,"m")==0 && a>=30 || strcmp(s,"f")==0 && a>=25)
            {
            printf("INSURANCE IS GIVEN");
            }
            else
            {
            printf("INSURANCE IS NOT GIVEN");
            }
            getch();
}

OUTPUT : DEPEND ON THE NUMBER YOU ENTER

------------------------------------------------------------------------------------------------------------------------------

Prog 18  :// This programme is to print the prime numbers.

# include <stdio.h>
# include <conio.h>
void main()
{
             int i,j,f=0;
             clrscr();
             for(i=2; i<=100; i++)
             {
            f=0;
            for(j=2; j<=i/2; j++)
            if (i%j==0)
            {
            f=1;
            break;
            }
             if(f==0)
             printf(" %d ",i);
             }
             getch();
             return 0;        
            ------------------------------------------------------------------------------------------------------------------------------

prog 18 :// This programme is to print the series 1,4,9,16,25..... upto 100

# include <stdio.h>
# include <conio.h>
main()
           
             int i;
             clrscr();
             for(i=1; i<=10; i++)
             printf("\t %d",i*i);
             getch();
             return 0;
            }
            ------------------------------------------------------------------------------------------------------------------------------

Prog 20 : // This programme is to print the series 0,3,8,15,24.... upto 99

# include <stdio.h>
# include <conio.h>
void main()
{
             int i;
             clrscr();
             for(i=1; i<=10; i++)
             printf("\t %d",i*i-1);
             getch();
             return 0;
}
------------------------------------------------------------------------------------------------------------------------------






Prog21 : // This programme is to print the series 100,98,96,94,92........ upto 2.

# include <stdio.h>
# include <conio.h>
void main()
{
            int i;
            clrscr();
            for(i=100; i>=2; i=i-2)
            printf("\t %d",i);
            getch();
            return 0;
}
------------------------------------------------------------------------------------------------------------------------------

Prog22 :// This programme is to print the series 2,4,6,8,10...... upto 100

# include <stdio.h>
# include <conio.h>
void main()
{
            int i;
            clrscr();
            for(i=2; i<=100; i=i+2)
            printf("\t %d",i);
            getch();
            return 0;
}



Prog22 :// This programme is to print 1 to 10 in decrement order

# include <stdio.h>
# include <conio.h>
void main()
{
            int i;
            clrscr();
            for (i=10; i>=1; i--)
            printf("\n %d",i);
            getch();
            return 0;
}
------------------------------------------------------------------------------------------------------------------------------
Prog23 : // This programme is to print 1 to 10 in increment order.
# include <stdio.h>
# include <conio.h>
main()
{
            int i;
            clrscr();
            for(i=1; i<=10; i++)
            printf("\n %d",i);
            getch();
            return 0;
}
------------------------------------------------------------------------------------------------------------------------------
Prog24 : // This programme is to print the series of Armstrong numbers

# include <stdio.h>
# include <conio.h>
# include <math.h>
void main()
{
             int i,j,sum=0;
             clrscr();
             for(i=1; i<=1000; i++)
             {
            sum=0;
            for(j=i; j!=0;)
             {
            sum=sum+pow((j%10),3);
            j=j/10;
             }
            if(sum==i)
             printf("\t%d",i);
            }
             getch();
             return 0;


Prog25 : // This programme is a chart of ASCII code

# include <stdio.h>
# include <conio.h>
void main()
{
             int i;
             clrscr();
             for(i=0; i<=255; i++)
             printf("%d-> %c ",i,i);
             getch();
             return 0;
}

            ------------------------------------------------------------------------------------------------------------------------------

Prog26 : find the no which div by 13 & 7

#include<stdio.h>
#include<conio.h>
void main()
{
            int num1,num2,res,i;
            clrscr();
            printf("Enter Value of Starting Range:->");
            scanf("%d",&num1);
            printf("Enter Value of Ending Range:->");
            scanf("%d",&num2);
            printf("\n\nList of Divisable nos. by 13 and 7 both\n\n");
            for(i=num1;i<=num2;i++)
            {
            if(i%91==0) // Because 13 * 7 = 91
            printf(" %d ",i);
            }
            getch();
}





Prog27 :prog for arrange space

#include<stdio.h>
#include<conio.h>
void main()
{
            int i,j,k,sp,s=0;
            clrscr();
            for (i=5; i>=1; i--)
            {
              for(j=1; j<=i; j++)
            printf("%d ",j);
              for(sp=1;sp<s;sp=sp+1)
             { printf ("  ");
             }
              s =s+2 ;
               for (k=i;k>=1;k--)
                 if(k!=5)
       printf("%d ",k);
              printf ("\n");
                   }
                getch();
}


output:

1 2 3 4 5 4 3 2 1
1 2 3 4   4 3 2 1
1 2 3       3 2 1
1 2           2 1
1               1
------------------------------------------------------------------------------------------------------------------------------








Prog28 : prog for numbers
           
#include<stdio.h>
#include<conio.h>
void main()
{
            int n=5;
            int i,j;
            clrscr();
            printf("%d",n);
            for (i=1; i<=n; i++)
            {
            for(j=1; j<=i; j++)
            printf("%d", j);
            printf ("\n");
            }
            getch();
}

output
1
12
123
1234
12345
------------------------------------------------------------------------------------------------------------------------------

Prog29 :Prog for displaying 1…10.
                       
# include <stdio.h>
# include <conio.h>
void main()
{
            int a[10],i,temp,j;
            clrscr();
            for(i=0;i<=9;i++)
            {
            printf("\n enter value one by one :");
            scanf("%d",&a[i]);
            }
            for(i=0;i<=9;i++)
            {
            for(j=0;j<=i;j++)
            {
            if(a[i]<a[j])
            {
            temp=a[i];
            a[i]=a[j];
            a[j]=temp;
            }
            }
            }
            for(i=0;i<=9;i++)
{
            printf("\n %d",a[i]);
            }
            getch();
}
                          OUTPUT
                           1
                           2
                           3
                           4
                           5
                           6
                           7
                           8
                           9
                           10
------------------------------------------------------------------------------------------------------------------------------
Prog30 : prog for numbers

#include<stdio.h>
#include<conio.h>
void main()
            {
            int n=5;
            int i,j;
            clrscr();
            printf("%d",n);
            for (i=1; i<=n; i++)
            {
            for(j=1; j<=i; j++)
            printf("%d", j);
            printf ("\n");
            }
getch();
}

output
1
12
123
1234
12345
------------------------------------------------------------------------------------------------------------------------------
Prog31 : prog for spiral numbers
           
#include<stdio.h>
#include<conio.h>
void main()
{
            int c=2,i,j,n,k;
clrscr();
printf("enter no=  :");
 scanf("%d",&n);
 for (i=1; i<=n;i++)
             for(j=1;j<=n-i;j++)
             printf ("   ");
               for (k=j; k<=n;k++)
               {
            printf("%3d", c);
              }
            printf("\n");
              }
               getch();
            }






output
enter no=  :3

                        2
                 2  2
              2  2  2
------------------------------------------------------------------------------------------------------------------------------
Prog32 :prog for arrange space

#include<stdio.h>
#include<conio.h>
void main()
{
            int i,j,k,sp,s=0;
            clrscr();
            for (i=5; i>=1; i--)
            {
              for(j=1; j<=i; j++)
            printf("%d ",j);
              for(sp=1;sp<s;sp=sp+1)
             { printf ("  ");
             }
              s =s+2 ;
               for (k=i;k>=1;k--)
  if(k!=5)
              printf("%d ",k);
              printf ("\n");
                   }
               getch();

output:
1 2 3 4 5 4 3 2 1
1 2 3 4   4 3 2 1
1 2 3       3 2 1
1 2           2 1
1               1





Prog33 :prog for finding a no whether it is prime or not

#include<stdio.h>
#include<conio.h>
void main()     
            {
            int i=2;
            int num;
            clrscr();
            printf("enter no :-");
            scanf ("%d", &num);
            while (i<=num-1)
            {
            if (num%i==0)
            {
            printf ("not a prime number");
            getch();
            break;
            }
            i++;
             }
            if (i==num)
            {
            printf ("is a prime number");
            getch();
            }
            }

output
enter no :-17
is a prime number
------------------------------------------------------------------------------------------------------------------------------










Prog34 : Prog for  displaying number

#include<stdio.h>
#include<conio.h>
void main()
{
            int no=1;
            int ans;
            clrscr();
            while (no<=100)
{

            if (no%2==0)
            printf ("\t%d", no);
            no++;
}         
            getch();
}
------------------------------------------------------------------------------------------------------------------------------
           
Prog35 : Prog to display the 1…..99
# include <stdio.h>
# include <conio.h>
void main()
{
            int i=1,j=0;
            clrscr();
            while(j<50)
            {
            if(i%2!=0)
            {
            printf("\t %d",i);
            j++;
            }
            i++;
            }
            printf("\n %d",j);
            getch();
}
           
              OUTPUT
               1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
               51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95
               97 99
------------------------------------------------------------------------------------------------------------------------------
prog36 : // This programme is to print the series 1,3,5,7,9..... upto 99.

# include "stdio.h"
# include "conio.h"
void main()
{
             int i;
             clrscr();
             i=1;
             while(i<=99)
             {
            printf("\t %d",i);
            i=i+2;
             }
             getch();
             return 0;
}
------------------------------------------------------------------------------------------------------------------------------
Prog37 : // This programme is to get the number in reverse manner.
# include <stdio.h>
# include <conio.h>
void main()
{
             int i,j=0;
             clrscr();
             printf("Enter the number : ");
             scanf("%d",&i);
             while(i!=0)
            {
             j=j*10+(i%10);
             i=i/10;
            }
             printf("%d",j);
             getch();
             return 0;
}
            Prog38 : // This programme is to print the series 1,2,4,7,11..... upto 10 steps.

# include <stdio.h>
# include <conio.h>
void main()
{
   int i,v,incr;
   clrscr();
   i=1;
   v=1;
   incr=1;
   while(i<=10)
   {
              printf("\t %d",v);
              i++;
              v=v+incr;
              incr=incr+1;
   }
   getch();
   return 0;
}
------------------------------------------------------------------------------------------------------------------------------
prog39 : // This programme is to print  1 t0 10 in increment order using  Do-while statement.

# include <stdio.h>
# include <conio.h>
void main()
{
   int i;
   clrscr();
   i=1;
   do
   {
             printf("\n %d",i);
             i++;
            }
   while(i<=10);
   getch();
   return 0;
   }

prog 40 :  print the reverse no

#incldue<stdio.h>
#include<conio.h>                 
void main()
{
            int no,tmpno=1;
            unsigned rev=0;
            clrscr();
            printf("\nEnter number to reverse it:->");
            scanf("%d",&no);
            tmpno=no;
            while(no>0)
            {
            rev= rev*10 + no%10;
            no /= 10;
            }
            printf("\n The reverse no is :->%u",rev);
            getch();
}
------------------------------------------------------------------------------------------------------------------------------
prog41 : print the multiplication table

#include<stdio.h>
#include<conio.h>
void main()
{
            int row,column,y,n;
            clrscr();
            row=1;
            printf("\n Enter any no for multiplication no:->");
            scanf("%d",&n);
            printf("Multiplication Table\n");
            printf("--------------------------------\n");
            do
            {
            column =1;
            do
            {
            y=row*column;
            printf("%4d",y);
            column=column+1;
            }
            while(column<=n);
            printf("\n");
            row=row+1;
            }
            while(row<=n);
            getch();
}
------------------------------------------------------------------------------------------------------------------------------

Prog42 : prog for swith….case statement,

#include<stdio.h>
#include<conio.h>
void main()

            {
            int i=2;
            clrscr();
            switch (i)
            {
                        case 1:
                                    printf("this is one \n");
                                    break;
                        case 2:
                                    printf("this is two \n");
                        case 3:
                                    printf("this is three \n");
                                    break;
                        default:
                                    printf("this is default \n");
            }
            getch();
            }
------------------------------------------------------------------------------------------------------------------------------





Prog43 : prog for numbers

#include<stdio.h>
#include<conio.h>
            void main()
{
            int n1,n2;
            int res;
            char op;
            clrscr();
            printf("Enter the two number :\n");
            scanf("%d %d",&n1,&n2);
            printf(" Enter the operatpor : ");
            fflush(stdin);
            scanf("%c",&op);
            printf ("%d",calc (n1,n2,op) );
            getch();
     }
            int calc (int i, int j, char ch)
            {
               switch(ch)
               {
                  case '+'  : return(i+j);
                  case '-'  : return(i-j);
                  case '*'  : return(i*j);
                  case '/'  : return(i/j);
                }
              return (0);
            }
------------------------------------------------------------------------------------------------------------------------------

prog 44 : perform add mul sub div using switch   

#include<stdio.h>
#include<conio.h>
void main()
{
            int a,b,res;
            char ch;
            clrscr();
            printf("Enter value of a :->");
            scanf("%d",&a);
            printf("Enter value of b :->");
            scanf("%d",&b);
            printf("Enter Operation choice ");
            scanf(" %c",&ch);
            switch(ch)
       {
            case '+':
            printf("\nAddition is %d", a+b);
            break;
            case '-':
                        printf("\nSub is %d", a-b);
                        break;
            case '*':
                        printf("\nMul is %d", a*b);
                        break;
            case '/':
                        printf("\nDiv is %d", a/b);
                        break;
            default:
                        printf("\nSorry ... Pls.. Enter proper choice");
      }
            getch();

}
------------------------------------------------------------------------------------------------------------------------------
prog 45 :prog for finding a no whether it is prime or not

#include<stdio.h>
#include<conio.h>
void main()
            {
            int i=2;
            int num;
            clrscr();
            printf("enter no :-");
            scanf ("%d", &num);
            while (i<=num-1)
            {
            if (num%i==0)
            {                      printf ("not a prime number");
                                    getch();
                                    break;
            }
                        i++;
             }
            if (i==num)
            {
                        printf ("is a prime number");
                        getch();
            }
            }

output
enter no :-17
is a prime number
------------------------------------------------------------------------------------------------------------------------------
prog46 : Prog for numbers

#include<stdio.h>
#include<conio.h>
void main()
{
            int no=1;
            int ans;
            clrscr();
            while (no<=100)
{
            if (no%2==0)
            printf ("\t%d", no);
            no++;
}
            getch();
}
------------------------------------------------------------------------------------------------------------------------------








Prog47 : prog to display 1..3..5 up to 99.

# include <stdio.h>
# include <conio.h>
void main()
{
            int i=1,j=0;
            clrscr();
            while(j<50)
            {
            if(i%2!=0)
            {
            printf("\t %d",i);
            j++;
            }
            i++;
            }
            printf("\n %d",j);
            getch();
}
                                   OUTPUT
                           1 3 5 7 9 11 13 15 17 19 21 23 25 27 29 31 33 35 37 39 41 43 45 47 49
                           51 53 55 57 59 61 63 65 67 69 71 73 75 77 79 81 83 85 87 89 91 93 95
                           97 99
------------------------------------------------------------------------------------------------------------------------------

`           Prog48 : This programme is to print the series 1,3,5,7,9..... upto 99.

# include "stdio.h"
# include "conio.h"
voidmain()
{
             int i;
             clrscr();
             i=1;
             while(i<=99)
             {
                        printf("\t %d",i);
                        i=i+2;
             }
             getch();
             return 0;
}
------------------------------------------------------------------------------------------------------------------------------

Prog49 : // This programme is to get the number in reverse manner.
# include <stdio.h>
# include <conio.h>
main()
{
             int i,j=0;
             clrscr();
             printf("Enter the number : ");
             scanf("%d",&i);
             while(i!=0)
            {
             j=j*10+(i%10);
             i=i/10;
            }
             printf("%d",j);
             getch();
             return 0;
}
------------------------------------------------------------------------------------------------------------------------------

Prog50 : This programme is to print the series 1,2,4,7,11..... upto 10 steps

# include <stdio.h>
# include <conio.h>
void main()
{
   int i,v,incr;
   clrscr();
   i=1;
   v=1;
   incr=1;
   while(i<=10)
   {
              printf("\t %d",v);
              i++;
              v=v+incr;
             incr=incr+1;
             }
             getch();
             return 0;
             }
------------------------------------------------------------------------------------------------------------------------------
Prog51 :  This programme is to print  1 t0 10 in increment order using  Do-while statement.

# include <stdio.h>
# include <conio.h>
void main()
{
   int i;
   clrscr();
   i=1;
   do
   {
             printf("\n %d",i);
             i++;
   }
   while(i<=10);
   getch();
   return 0;  
}
------------------------------------------------------------------------------------------------------------------------------
prog52 :  print the reverse no

# include <stdio.h>
# include <conio.h>
void main()
{
            int no,tmpno=1;
            unsigned rev=0;
            clrscr();
            printf("\nEnter number to reverse it:->");
            scanf("%d",&no);
            tmpno=no;
            while(no>0)
            {
            rev= rev*10 + no%10;
            no /= 10;
            }
            printf("\n The reverse no is :->%u",rev);
            getch();
}
------------------------------------------------------------------------------------------------------------------------------
Prog53  print the multiplication table

#include<stdio.h>
#include<conio.h>
void main()
{
            int row,column,y,n;
            clrscr();
            row=1;
            printf("\n Enter any no for multiplication no:->");
            scanf("%d",&n);
            printf("Multiplication Table\n");
            printf("--------------------------------\n");
            do
            {
            column =1;
            do
            {
                        y=row*column;
                        printf("%4d",y);
                        column=column+1;
                        }
                        while(column<=n);
                        printf("\n");
                        row=row+1;
            }
            while(row<=n);
            getch();
}







Prog 54 : prog for counting avg of 10 marks

#include<stdio.h>
#include<conio.h>
void main()
{
            int marks[10];
            int i,sum=0;
            float avg;
            clrscr();
 for (i=0;i<10;i++)
            {
            printf ("\nEnter marks %d: ",i+1);
            scanf ("%d", &marks[i]);
            }
  for (i=0;i<10;i++)
             sum=sum+marks[i];
  avg=sum/10.0;

            printf("\n\n\n");
            printf("avg is %f",avg);
            getch();
}

output:
Enter marks 1: 12
Enter marks 2: 13
Enter marks 3: 14
Enter marks 4: 15
Enter marks 5: 16
Enter marks 6: 17
Enter marks 7: 18
Enter marks 8: 19
Enter marks 9: 11
Enter marks 10: 10
avg is 14.500000





prog55 : prog for displaying 10……1 .                  
# include <stdio.h>
# include <conio.h>
void main()
{
            int a[10],i,temp,j;
            clrscr();
            for(i=0;i<=9;i++)
            {
            printf("\n enter value one by one :");
            scanf("%d",&a[i]);
            }
            for(i=0;i<=9;i++)
            {
            for(j=0;j<=i;j++)
            {
            if(a[i]>a[j])
            {
            temp=a[i];
            a[i]=a[j];
            a[j]=temp;
            }
            }
            }
            for(i=0;i<=9;i++)
            {
            printf("\n %d",a[i]);
            }
            getch();
}
                           OUTPUT
                           10
                           9
                           8
                           7
                           6
                           5
                           4
                           3
                           2
                           1
Prog56 : // program for addition of two matrix

#include<stdio.h>
#include<conio.h>
void main()
{
            int a[3][3],b[3][3],c[3][3];
            int i,j,l,m;
            clrscr();
            printf("Enter the elements in the first matrix\n");
            for(i=0;i<3;i++)
            {
                        for(j=0;j<3;j++)
                        {
                                    scanf("%d",&a[i][j]);
                        }
            }
            printf("Enter the elements in the second matrix\n");
            for(l=0;l<3;l++)
            {
                        for(m=0;m<3;m++)
                        {
                                    scanf("%d",&b[l][m]);
                        }
            }

            printf("You have the following numbers into first matrix\n");
            for(i=0;i<3;i++)
            {
                        for(j=0;j<3;j++)
                        {
                                    printf("%d",a[i][j]);
                        }
                        printf("\n");
            }
            printf("\nThe Addition of the two matrix are\n");
            for(i=0;i<3;i++)
            {
               for(j=0;j<3;j++)
               {
                        c[i][j]=a[i][j]+b[i][j];
               }
            }
            for(i=0;i<3;i++)
            {
                        for(j=0;j<3;j++)
                        {
                                    printf("%d   ",c[i][j]);
                        }
                        printf("\n");
            }
getch();
}
------------------------------------------------------------------------------------------------------------------------------

Prog57 : prog for two dimention array
           
#include<stdio.h>
#include<conio.h>
void main()
{
   int arr[3] [4];
   int i,j;
   clrscr();
   for (i=0; i<3; i++)
            {
             for(j=0; j<4; j++)
               {
             printf ("\n Enter a no at[%d] [%d]  :", i,j);
             scanf ("%d", &arr [i][j]);
               }
             }
             for (i=0; i<3; i++)
               {
             printf ("\n The no at[%d][%d] is  :%d", i,j,arr[i][j]);

               }
            }





output

            Enter a no at[0] [0]  :12

            Enter a no at[0] [1]  :12

            Enter a no at[0] [2]  :13

            Enter a no at[0] [3]  :14

             Enter a no at[1] [0]  :14

              Enter a no at[1] [1]  :15

               Enter a no at[1] [2]  :14

            Enter a no at[1] [3]  :13

             Enter a no at[2] [0]  :16

              Enter a no at[2] [1]  :17

               Enter a no at[2] [2]  :18

            Enter a no at[2] [3]
  : 12
------------------------------------------------------------------------------------------------------------------------------

Prog58 : DEFINATION:-TO PRINT ARRAY IN THE ASENDING ORDER

#include<stdio.h>
#include<conio.h>
void main()
{
int arr[5];
int i,j,temp;
clrscr();
for(i=0;i<5;i++)           {
             printf("Enter the element [%d]:",i);
             scanf("%d",&arr[i]);
             }
for(i=0;i<5;i++)
{
            for(j=i+1;j<5;j++)
                        {
                        if(arr[j]<arr[i])
                                    {
                                                temp=arr[i];
                                                arr[i]=arr[j];
                                                arr[j]=temp;
                                     }
                         }
}
for(i=0;i<5;i++)
{
//printf("the ascending element [%d]:",i);
printf("\n\t %d",arr[i]);
}
getch();
}

OUTPUT
Enter the element [0]:5
Enter the element [1]:4
Enter the element [2]:2
Enter the element [3]:0
Enter the element [4]:1

                                    0
                                    1
                                    2
                                    4
                                    5








PROG 59 :TO PRINT THE AVERAGE OF THE ARRAY ELEMENT

#include<stdio.h>
#include<conio.h>
void main()
{
int stu[5];
int i,n,sum=0;
float Avg;
clrscr();
printf("How many marks are entered");
scanf("%d",&n);
            for(i=0;i<5;i++)
            {
            printf("\n Enter the value of student[i]");
            scanf("%d",&stu[i]);
            }
            for(i=0;i<5;i++)
            sum+=stu[i];

            printf("%f",sum/5.0);
            getch();
}

OUTPUT

Enter the value of student[i]5

Enter the value of student[i]6

Enter the value of student[i]7

Enter the value of student[i]8

Enter the value of student[i]9

7.000000




Prog60 : To find the maximum and minimum number using array.

#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
int num[5];
int i,max,min;
clrscr();
for(i=0;i<5;i++)
            {
            printf("Enter the value at [%d]:",i);
            scanf("%d",&num[i]);
            }
            max=num[0];
for(i=0;i<5;i++)
            {
            if(num[i]>max)
            max=num[i];
            }
            min=num[0];
for(i=0;i<5;i++)
            {
            if(num[i]<min)
            min=num[i];
            }
            printf("\n max value is %d",max);
            printf("\n\n min value is %d",min);
            getch();
}

OUTPUT
Enter the value at [0]:5
Enter the value at [1]:4
Enter the value at [2]:3
Enter the value at [3]:90
Enter the value at [4]:88
            max value is 90
 min value is 3

PROG61 : TO SERACH A CHARECTER IN THE ARRAY.

#include<stdio.h>
#include<conio.h>
#include<stdio.h>
void main()
{
char str[15];
char n;
int i=0,c=0;
clrscr();
              printf("\n\tEnter the string:  ");
              gets(str);
              printf("\n\tEnter search character:  ");
              scanf("%c",&n);
while(str[i])
{
if(str[i]==n)
            c++;
            i++;
}
printf("\n\tIn the string %d times are character are search ",c);
getch();
}

          OUTPUT
            Enter the string:  VIBHAKAR
            Enter search character:  A
            In the string 2 times are character are search
           
------------------------------------------------------------------------------------------------------------------------------

PROG 62 :Prog for binary search

# include <stdio.h>
# include <conio.h>
int SIZE=10;
void main()
{
            int i,j,m,tmp,n,s,a[10],f,l,yn=0;
            clrscr();
            fflush(stdin);
            for (i=0; i<SIZE; i++)
            {                     
printf ("Enter a[%d] element :",i);
            scanf("%d",&a[i]);
            }
            for (i=0; i<SIZE; i++)
            {
            for (j=i+1; j<SIZE; j++)
            {
            if (a[i]>a[j])
            {
            tmp=a[i];
            a[i]=a[j];
            a[j]=tmp;
            }
            }
            }
            printf ("Enter Element to be Found : ");
            scanf ("%d",&s);
            f=0;
            l=SIZE-1;
            while (f<=l)
            {
            m=(f+l)/2;
            if (s>a[m])
            f=m+1;
            else
            {
            if (s<a[m])
            l=m-1;
            else
            if(s==a[m])
            {
            yn=1;
            break;
            }
            }
            }
            if (yn==1)
            printf ("\n %d element is Found ",s);
            else
            printf ("\n %d element is NOT found",s);
            getch();
}

 OUTPUT
            Enter a[0] element :1
            Enter a[1] element :2
            Enter a[2] element :3
            Enter a[3] element :6
            Enter a[4] element :4
            Enter a[5] element :5
            Enter a[6] element :9
            Enter a[7] element :5
            Enter a[8] element :2
            Enter a[9] element :3
            Enter Element to be Found : 3
            3 element is Found
------------------------------------------------------------------------------------------------------------------------------
Prog 63 :prog for two dimention array

#include<stdio.h>
#include<conio.h>
void main()
{
             int i,j,temp,*ptr,*ptr1;
            clrscr();
             ptr = &i;
             ptr1 = &j;
            printf ("\n Enter number-1  :");
              scanf ("%d", &i);
             printf ("\n Enter number-2  :");
             scanf ("%d", &j);
              temp = *ptr;
            *ptr = *ptr1;
             *ptr1= temp;
             printf ("\n Number after swapping ");
             printf ("\n The first no is :%d", *ptr);
            printf ("\n The second no is :%d", *ptr1);      
            getch();
}

output
 Enter number-1  :13
 Enter number-2  :45
 Number after swapping
 The first no is :45
 The second no is :13
------------------------------------------------------------------------------------------------------------------------------

Prog 64 : prog for two dimention array

            #include<stdio.h>
#include<conio.h>
void main()
{
   int i,j,temp,*ptr,*ptr1;
   clrscr();
   ptr = &i;
   ptr1 = &j;
   printf ("\n Enter number-1  :");
   scanf ("%d", &i);
   printf ("\n Enter number-2  :");
   scanf ("%d", &j);
   temp = *ptr;
   *ptr = *ptr1;
   *ptr1= temp;
   printf ("\n Number after swapping ");
            printf ("\n The first no is :%d", *ptr);
            printf ("\n The second no is :%d", *ptr1);
             getch();
}

output
            Enter number-1  :13
            Enter number-2  :45
            Number after swapping
            The first no is :45
            The second no is :13



Prog 65 : prog for swaping using pointer

#include<stdio.h>
#include<conio.h>
#include<string.h>
            void main()
{
   char i,j,temp,*ptr,*ptr1;
   clrscr();
   ptr  =&i;
   ptr1 =&j;
   printf ("\n Enter string1  :");
            scanf ("%c",&i);
   fflush (stdin);
   printf ("\n Enter string2  :");
   scanf ("%c",&j);
   temp =*ptr;
  *ptr =*ptr1;
   *ptr1=temp;
   printf ("\n String after swapping ");
   printf ("\n The first string is :%c", *ptr);
            printf ("\n The second string is :%c",*ptr1);
            getch();
}

output
    Enter string1  :qwe
    Enter string2  :wer
    String after swapping
    The first string is :w
     The second string is :q











Prog 66 :prog for counting spaces,lines blanks,tabs
           
#include<stdio.h>
#include<conio.h>
void main()
{
            FILE *fp;
            char ch;
            int nol=0,not=0,nob=0,noc=0;
            fp=fopen("z:\search.c","r");
            clrscr();
               while(1)
               {
                  ch=fgetc(fp);

                  if (ch==EOF)
                  break;
                  noc++;
                  if (ch==' ')
                  nob++;
                  if (ch=='\n')
                  nol++;
                  if(ch=='\t')
                  not++;
               }
               fclose(fp);
               printf("\n Number of char = %d",noc);
               printf("\n Number of blanks = %d",nob);
               printf("\n Number of tabs = %d",not);
               printf("\n Number of lines = %d", nol);
               getch();
               return (1);
            }

------------------------------------------------------------------------------------------------------------------------------






Prog67 : prog for file handling

#include <stdio.h>
#include <conio.h>
void main()
{
  FILE *fp,*fc;
  char ch;
  clrscr();
  fp=fopen("z:\\abcd.txt","r");
  fc=fopen("z:\\ab.txt","w");
  if (fp==NULL)                     {
            puts ("can not find a file please try again");
            }
            else
            {
            while((ch=fgetc(fp))!=EOF)
            {
            fputc(fp);
            printf("%c",ch);
            }
            fclose(fp);
            fclose(fc);
            }
            getch();
            }
------------------------------------------------------------------------------------------------------------------------------

Prog 68 : Binary Tree Creation and Traversals  
           
#include <stdio.h>
#include <conio.h>
struct bTreeNode
{
 int data;
 struct bTreeNode *lChild;
 struct bTreeNode *rChild;
};


void main()
{
  struct bTreeNode *bt;
  int tot,no,i=1;
  clrscr();
  bt=NULL;
  printf("\n Specify no of items : ");
  scanf("%d",&tot);
             while(i<=tot)
  {
   printf("\n Enter Data:");
   scanf("%d",&no);
   insert(&bt,no);
   i++;
  }
  printf("\n Traversing tree in inOrder Traversal  :\n");
  inOrder(bt);
  printf("\n Traversing tree in preOrder Traversal  :\n");
  preOrder(bt);
  printf("\n Traversing tree in postOrder Traversal  :\n");
  postOrder(bt);
  getch();
}
Insert(struct bTreeNode **bRoot,int n){
 if (*bRoot == NULL)
 {
    *bRoot = malloc(sizeof(struct bTreeNode));
    (*bRoot)->lChild = NULL;
    (*bRoot)->data = n;
    (*bRoot)->rChild = NULL;
    return;
 }
 else
 {
            if (n < (*bRoot)->data)
             insert ( &((*bRoot)->lChild),n);
            else
            insert(&((*bRoot)->rChild),n);
 }
            return;
}
inOrder(struct bTreeNode *bRoot)
{
  if (bRoot!=NULL)
  {
     inOrder(bRoot->lChild);   
     printf("%4d",bRoot->data);
     inOrder(bRoot->rChild);
  }
  else   
    return;
}
preOrder(struct bTreeNode *bRoot)
{
  if (bRoot!=NULL)
  {
     printf("%4d",bRoot->data);
     preOrder(bRoot->lChild);
     preOrder(bRoot->rChild);
  }
  else
    return;
}

postOrder(struct bTreeNode *bRoot)
{
             if (bRoot!=NULL)
  {
             postOrder(bRoot->lChild);
             postOrder(bRoot->rChild);
            printf("%4d",bRoot->data);
             }
            else
             return;
}


------------------------------------------------------------------------------------------------------------------------------




prog 69 structure

#include<stdio.h>
#include<conio.h>
#nclude<stdlib.h>
struct raj
            {
   int code;
   char nm[30];
   struct raj *r;
 };
  typedef struct raj node;
            nt menu();
            oid add();
            oid del();
            oid view();
            ode *fst=NULL,*lst=NULL;

             void main()
           
            nt opt=1;
             clrscr();
            hile(opt!=0)
            {
            pt=menu();
            witch(opt)
           
             case 1: add();
            reak;
            ase 2: del();
            reak;
            ase 3: view();
           
             }
           
             int menu()
            {
            int choice;
            lrscr();
            printf("\n0...exit");
            printf("\n1....add");
            printf("\n2....del");
             printf("\n3....vie");
            rintf("\nwhat is your choice: ");
            scanf("%d",&choice);
             return(choice);
              }
             void add()
             {
            if(fst==NULL)           {
               fst=lst=(node*)malloc(sizeof(node));
               printf("\nenter the node:-  ");
               scanf("%d",&fst-> code);
               printf("enter name:-  ");
               fflush(stdin);
               gets(fst->nm);
               fst->r=NULL;
             }
             else
             {
              lst->r=(node*)malloc(sizeof(node));
              lst=lst->r;
              lst->r=NULL;

              printf("\nenter the code:-  ");
              scanf("%d",&lst->code);
              printf("\nenter the name :-  ");
              fflush(stdin);
              gets(lst->nm);
             }
             }
            void del()
                {
             node *dst;
             dst=fst;
              if(fst==NULL)
               {
                 printf("\nempty queue");
                 getch();
                 return;
               }
               fst=fst->r;
               printf("\ndeleted code is = %d",dst->code);
               free(dst);
               getch();
            }

             void view()
             {
                node *vpt;
                vpt=fst;
                if(vpt==NULL)
                {
                  printf("\n queue is not created ");
                  getch();
                  return;
                }
                 while(vpt!=NULL)
                {
                  printf("\ncode:- %d",vpt->code);
                  printf("\tname:- %s",vpt->nm);
                  vpt=vpt->r;
                }
                getch();
             }




prog 70 :"program of stack operation"

#include <stdio.h>
#include <conio.h>
struct stack
{
            int data;
            struct stack *prev;
};
struct stack *node;
void main()
{
            int ch,n;
            char c;
            clrscr();
            node=NULL;
            printf("\n 1. Push ");
            printf("\n 2. Pop ");
            printf("\n 3. Display");
            printf("\n 4. Exit");
            printf("\n Enter your choice (1-4): ");
            scanf("%d",&ch);
            while(ch>=1&&ch<=4)
            {
                        switch(ch)
                        {
                                    case 1:

                                                push(node);
                                                break;

                                    case 2:
                                                pop(node);
                                                break;

                                    case 3:
                                                disp(node);
                                                break;
                                    case 4:
                                                exit(0);
                        }
                        getch();
                        clrscr();
                        printf("\n 1. Push ");
                        printf("\n 2. Pop ");
                        printf("\n 3. Display");
                        printf("\n 4. Exit");
                        printf("\n Enter your choice (1-4): ");
                        scanf("%d",&ch);
            }
            getch();
}
push(struct stack *rec)
{
            struct stack *new1;
            new1=(struct stack *)malloc(sizeof(struct stack));
            printf("\nEnter element to push: ");
            scanf("%d",&new1->data);
            new1->prev=rec;
            node=new1;
            return (0);
}
pop(struct stack *rec)
{
            node=rec->prev;
            free(rec);
            return (0);
}
disp(struct stack *rec)
{
            while(rec)
            {
                        printf("\n%d",rec->data);
                        rec=rec->prev;
            }
                        return (0);
}




Twitter Delicious Facebook Digg Stumbleupon Favorites More

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Grants For Single Moms