If You Are From The 09 Batch Then Read This >>

This Site is created for the Bharati Vidyapeeth's BCA 09 Batch..and hence everyone from you are requested to send your email ID at abhilash238650@gmail.com..Owner will send you a request to your Email-ID and after accepting it even you can post your views, day to day experiences and class works on this blog.
Visit owner's blog at
www.bloggerabhilash.info

Wednesday, June 13, 2012

We Are Graduated!!!

Heartiest Congratulations to everyone who have passed the Final Semester successfully and can scream out in the world that "I am a Graduate". For those people who are still to get a Passing Certificate, make this 1 year the most hard-working year of your life and bring it up when you attend the KT examinations this year.. Thanks.

And A Shout Out to Siddhesh Patil who has topped our class. Keep it up,buddy. 

Friday, May 18, 2012

Jab we met 1


         It was my first day of college and I was standing outside of the classroom. With the proper uniform which was sky blue shirt and navy blue pant. Lots of thoughts were running in my mind, how the other students will be..?? Will they become my friend..?? Will they talk to me..? How they will behave with me..?? Shall I mix up with them...?? How the faculties will be..?? How the class teacher will be..?? Enough…!!! “If I keep thinking I will stand here for the entire day.” After saying this to myself I entered in the classroom. All the students were already present there. Girls were on the left side and boys were on the right side. No one was talking to each other it was a pin drop silence. Because it was new for everyone new college, new friends. I went to the last bench already there was one student he was alone there. I asked him for seat, he smiled but didn’t move again I asked and the same thing happened. I got confused now what to do..?? Whether he is understanding what I am trying to say or not..?? I was standing and he was smiling. After sometime he said “are baith na khada kyu hai..??” and I sat.
          Sir entered in class. He introduced himself as the coordinator of the class and the name was ‘Zahir Mulani.’ J Then he started :- “good morning everyone.”
All :- “good morning sir”
Sir :- “my name is zahir mulani and I am your coordinator. I have done my MCA from Bharti Vidyapeeth pune. From this year I have joined. Today is your first day in BVIMED navi Mumbai for BCA course. You have paid here 50,000rs so make sure you will utilize it. If you will have any doubt with related to anything then you can come to me and ask me, I will surely help you. All the very best for your next 3 years.”
All :- “Thank you sir.”
Sir :- “Now I will call your name and will give your roll no and after completing this you all will have to tell about yourself your name, where do you live and why did you choose BCA….??”
That boy :- “Are tune kyu BCA me admission liya…??”
Me :- “Are muze 12th me marks kam the kahi aur admission nai mil raha tha isliye liya, aur tune kyu liya…?”
Boy :- “me bhi yahi reason bolta hun..!”
Sir :- “Arya 1, Vrushali 2, Samadhan 3, Yusuf 4, Prasad 5, Archana 6, sohail mulani 7, Prashant 8, sulkshana 9, Tushar 10, Siddesh 11, Abhilash 12, Prema 13,  Gaurav 14, Saquib 15, Vandana 16, Sohail shaikh 17, Richa 18, Swati 19, sameer 20, Vishal 21, Arun 22, Manoj 23. Now start with your introduction from roll no 1.”
(Continued…..)

Monday, May 14, 2012

Its not a respect its an awe.

           I shifted to hostel just one day before the college starts and it was a very bad experience of my journey. Before shifting to hostel my relatives, cousins were telling me the hostel life is very much interesting and you will enjoy a lot. You will learn new things, you will become responsible, you will learn how to manage the time and also you will learn how to wash your own cloths. :P Everyone was telling their own experiences, memorable and thrilling movements. they were very much desperate to tell me about hostel life. My dad was living in hostel while he was in school. So he used to tell me about his experiences, his saga and every time i dreamed to live in hostel at once. and my dream came true. But it was very much different than my relatives and cousins' words.
         The hostel was located at the back side of college and it was very close to college. Actually it wasn't hostel it was a residential building which was given to college to use as a hostel. because 4-5 years ago someone had attempted suicide and after that some horrible things started happening so all the resident left. That hostel was really looking horrible, there were cracks on the wall, no colour on the wall. The glass of the windows were broken. It was the condition of the hostel but it was okay for me because i didn't want to live there for lifelong, it was just a case of 3 years. My room was at first floor among 7 floors. At the ground floor there was a common room with a TV. and also there was a room of hostel controller and the right side there was a mess. So it was a structure of hostel. In my room already 4 seniors were staying. I will introduce you with them, just wait.
        I was only junior in that entire hostel so i was just feeling awkward because no one was with me. Everybody were with their own groups. While i was roaming in the hostel everybody were looking at me and were discussing something among the groups. I wanted to know that what they are discussing but i couldn't ask.
      I was sitting in my room after dinner. I was unable to sleep because that place was new for me and i was not feeling well so many questions were going on in my mind i wanted their answers but no one was there to answer me. at that time 1 senior came in my room and told me that 3 others are calling you so you have to come. There were total 3 rooms 1st was mine and then there was a toilet after toilet at the left side there was one room and at the right side there was another room. That senior took me to the right side and sat on the bed. All the 4 were sitting on the bed like a king. and they told me to stand in front of them like i stand in front of the teacher.
    i stood. they started introducing themselves "hi, i am karan doing BBA 3rd year."
"me amay hun aur BBA kar raha hun 2nd year me hun." "i am jeet doing BCA3rd year." "i am rakesh MCA 3rd year." i was quiet.
karan:- "hamne yaaha pe kuch rules banaye hai jo tumhe follow karne hai. rule no 1 yaaha pe sab log unke seniors ko respect dete hai. to muze bhi aise lagta hai ke mere junior muze respect de, to aaj se tum hame respect doge. aur agar hame bulana hai to bhaiya kehke bulaoge. rule no 2 hamari har baat manoge." i nodded.
karan :- "senior ko ye jaanna jaruri hai ki uska junior kaisa hai...?? uski level of understanding kya hai...?? to uske liye ham tumhara intro lenge, jisme tumhe batana hai tumhara naam, parents ka naam, parents kya karte hai, 10th me kitne marks aaye, 12th me kitne marks aaye aur kaha rehte ho. ya to sab kuch hindi me bolna hai ya to sab kuch english me bolna hai. agr bolte waqt kuch gadbad hui to flush karna hai."
i asked "ye flush kya hota hai..?"
karan:- "toilet me jaa aur jo flush ka button hai wo daba, uske baad jo awaj aayegi waise aavaj nikalni hai."
i said "ok."
karan:-"tumhe jitna time chahiye prepare karne ke liye utna le lo par kuch galti hui to flush karna padega, ab jao apne room me aur prepare hone ke baad aajao."
             i left that room and came into my room. I was scared now what to do..?? i got what those senior were discussing, they were planning for this it means after facing these 4. I have to face lot more. I was alone there so i had no choice. I also thought to ran away, let them wait, they will wait and then sleep but where should i go...? they will find me in college............ I started preparing for that. When i thought i have done then i went in that room.
karan:- "ho gaya preparation. abhi start karo."
I :- "my name is gaurav save. ummmmmmm"
karan :- "flush"
I :- "flush"
karan :- "aise nai. flush karne ke baad jaise awaj ati hai waise nikalo"
I :- "sssshhhhhhhhhh"
karan :- "firse shuru karo"
I :- "my name is aaaaaaaammmmmm"
it was happening because of fear. After 3-4 attempts i done with it. after that they started asking me silly questions. At 3am this introduction section ended. I went to sleep.
           I would like to tell you my seniors you shown me your standards, you shown me from which background you belongs to. You called yourself as a senior, what you have done for your juniors..?? any productive work...?? or any thing which can help the juniors..? you are senior or a beggar...?? you are asking for respect..?? respect is not like you will ask and you will get, respect is something which you have to earn. Respect is not given by brain it is given by heart. If you want a respect then first give the respect. You are older than me is it reason to give you respect...??? tell me what you have done till now from the day you born...??? anything that you can tell proudly..?? you have done anything that your parents can feel proud on you..??? you have done anything for this nation, for this state, for this city, for your family...?? no. then why should i respect you...??
          I am telling those seniors who are acting like a king and treating their juniors as a slave. You do ragging to prove yourself as senior you show your powers to your juniors. why...???
just because your seniors treated you like this..?? so what...?? you can break this chain. you can bring the change. If you are ill-treating to your juniors and telling them to also ill-treat their juniors. Then you are promoting the ragging. You are not doing any qualitative work.
         so i want to tell you people if you are a senior then please don't act like a boss with your juniors, don't demotivate him/her, never go to prove yourself more powerful because you will never know how he/she will suffer. there are so many students who committed suicide because of ragging, torture. and the reason is you. Today its someone else but tomorrow can be you. So please stop doing this and bring the revolution. 

Saturday, May 12, 2012

.......And the journey begins...!

            It was the day of 12th result. and i was sitting quietly. because i had scored poor marks in the exam. I was not getting admission anywhere. so I was just listening all the taunts made by my parents. it was irritating and frustrating me. and i was feeling like a prisoner, who has committed offence.
           One of the friend of my dad told him that there is BCA 3year course in Bharti vidyapeeth belapur. it is a computer related course every year 2sem and they have their own entrance exam. it is their own CET exam and according to that CET exam's result they give the admission. My dad told me about that i said yes without asking any question about college and courses. as i had no choice because "all the doors were closed, in front of my nose."
           After 2 days my dad brought the brochure of bharti vidyapeeth. The brochure was very good in terms of designing. The college was looking very nice. That brochure was showing AC class rooms, AC computer laboratories, big campus, ground etc. i got surprised after seeing these things. I was thinking i will get an admission in this college, will sit in AC class rooms, AC computer laboratories. :-) My interest towards computer was started increasing and i started dreaming to take an admission in this college at the very first it was the compulsion for me to take an admission in that college but after seeing the brochure it became my dream. I read that brochure completely and i found there are only 60 seats available for the BCA. So i filled the form and started studying hard according to their syllabus. after few days the exam was in that college itself.
          According to me i had studied enough. the exam time was at 2 o'clock. i reached the belapur station at 1pm. I just shocked after seeing the huge station like CBD as i had not seen such a big station in my entire life. very much cleaned and well maintained. There was very huge place for parking the vehicles,separate lane for auto rikshaw, all were just coming in a row, people were waiting for auto in a queue, very much wide roads. The buses, trucks like all the heavy vehicles were passing from the very left lane and other vehicles were passing from the right lane, all were following the traffic rules including all the pedestrians. all were going in particular manner and in a disciplinary way. I just impressed after observing all these things.
i was feeling like i have came in a foreign country. :P at 1.30pm I reached the college it took me half an hour to observe all these things. It was an awesome movement of life. I found that the college which was shown in the brochure was little different than the actual. After entering from the gate at the front side there was pharmaceutical college at the right side there was a play ground and after walking at the left side there was management college at the back side of management college there was a canteen. The campus was situated between the management college and the canteen. In the campus many trees were planted in a row. I entered in the class room already there were around 30 people. some were looking studious, some were clever and some where like me just looking here and there. The exam started. Now I wont waste the time to telling you what the questions were the asked and what the answers i wrote. Because I don't remember. I would only tell you it was good. without asking anybody about anything i left the belapur and came back to home.
        I got my result by the post. i had scored very good marks in CET exam. was feeling happy because i was getting an admission in that college which i was dreamed to. after some days i had to go to pune to take an admission as the main college of bharti vidyapeeth is located in the pune. I had to reached there by 10am. so my dad booked the ticket of intercity express for pune. we left for pune at 7am. and my journey started from the dream city to the city of wisdom. I reached the pune exactly at 9.30am. i took a cup of tea and started observing it was also very big and busy station. I came out of the station and started asking people about the bharti vidyapeeth college but those people were not answering me properly was not giving proper information, they were not helpful, had attitude, selfishness etc. Even then i managed to find out the college that is why we people call mumbaikar. we can manage all the things that we have learned from the dream city mumbai.
        we people always late but I reached college on time. The college was bigger than the belapur's college. we call the pune as the home of the wisdom. the college itself was showing it. After entering in the campus from the right side there was college of management for MBA and BBA, after that the college of BCA and MCA then LAW and medical. The college were situated in a circular form. Every colleges had their own campus and own play ground. I saw the crowd in front of the entrance  of the BCA and MCA college. I went there. some students were sitting on the chairs and some were checking their ranks among all the students. I went there and started searching for rank. After getting the rank i sat on chair and was waiting for my turn. everybody was just exited about the admission as i was. Some were coming out from the college and were calling their parents to tell the confirmation about the admission. They were looking very much happy. It seemed that they are waiting for the opening of the college. After some time they announced the ranks and my rank was also in that. I went there they confirmed the name and marks then i filled all the forms, paid the fees of college and also of the hostel. As i was living far away from the belapur the distance from my home to college was same like the distance from mumbai to pune. They gave me the slip and my admission got confirmed. :-)
         I was filling very happy as i got the admission in the bharti vidyapeeth college. Now i had to study in this college for next 3 years. I really didn't know how it will be. I only knew that i have caught the train of bharti vidyapeeth and my destination is BCA. and the journey begins.............
         my friends in this journey of 3 years lots of things happened with me and my friends some were mysterious, some were horror, some were tragic and funny also. So there are lot more to come. stay tuned.

Tuesday, May 8, 2012

ORACLE

Average:-



SELECT Customer FROM Orders
WHERE OrderPrice>(SELECT AVG(OrderPrice) FROM Orders

Between Query:



select Empid,Empname from employee1
 where date between '
2008-12-23'and '2008-12-25';

Count Query:



SELECT COUNT(student) AS studentSAM FROM Orders
WHERE Customer='stud'

Having:



SELECT department, MAX(salary) as "Highest salary"
FROM employees
GROUP BY department
HAVING MAX(salary) < 50000;

Join Tables:-




join 3 tables with the following variables


table1 : ssn, name
table2: ssn, fav_color
table3: ssn, fav_food


SELECT table1.name, table2.fav_color, table3.fav_food
FROM table1, table2, table3
WHERE table1.ssn = table2.ssn
and table2.ssn = table3.ssn;


LIKE QUERY:


SELECT * FROM student WHERE name LIKE 's%'

Maximum:


SELECT MAX(marks) AS maximumMarks FROM Stud;

Minimum:-


SELECT MIN(OrderPrice) AS SmallestOrderPrice FROM Orders

SUM:-


SELECT SUM(OrderPrice) AS OrderTotal FROM Orders;

VIEW:-


CREATE VIEW [Products Above Average Price] AS
SELECT ProductName,UnitPrice
FROM Products
WHERE UnitPrice>(SELECT AVG(UnitPrice) FROM Products);






C++ PROGRAMS

Add, Int, Float, Double



#include
#include
int add (int a,int b);
float add (float a, float b, float c);
double add (double x, double y);
{
return (a+b)
}
float add (float a, float b, float c);
{
return (a+b+c)
}
double add (double x, double y);
{
return (x+y)
}
void main()
{
clrscr();
cout<
cout<
cout<
getch();
}


CALCULATE INTEREST:



#include(iostream.h)
#include(conio.h)
#include(math.h)

void main()
{
double p, r, t, i, am;
cout<< " Enter principal, rate , time ?";
cin>> p >> r >> t;

i = (p * r* t) / 100;
am = p + i;

cout<< "\n Principal Amt = Rs. " << p;
cout<< "\n Rate = " << r << "%" ;
cout << "\n Time = " << t << "yrs.";
cout<< "\n The Interest Amt = Rs. " << i ;
cout<< "\n The Total Amt = Rs. " << am;
am = pow((p* ( 1 + (r/100)), t);
i = am - p;
cout << "\n The Interest Amt = Rs. " << i;
cout<< "\n The Total Amt = Rs. " << am;


getch();
}


FIND QUOTIENT AND REMINDER ADDING 2 INTEGER:



#include

#include

int main()

{ // Code Copyright @ Coders Guide http://codersguide.org

clrscr();

int x,y,add,quotient,remainder;

cout << “Enter 2 integers: ”;

cin>>x>>y;

add= x+y;

quotient=x/y;

remainder=x-(quotient*y);

cout << “addition of ” << x << ” & ” << y << ” = ” << add << “\n”;

cout << “Quotient of ” << x << ” & ” << y << ” = ” << quotient << “\n”;

cout << “Remainder of ” <<  x << ” & ” << y << ” = ” << remainder << “\n”;

getch();

return 0;

}


FRIEND FUNCTION:


#include
#include
class Cmplx1
{
int real,imagin;
public :
void get()
{
cout<<"\n\n\t ENTER THE REAL PART : ";
cin>>real;
cout<<"\n\n\t ENTER THE IMAGINARY PART : ";
cin>>imagin;
}
friend void sum(Cmplx1,Cmplx1);
};
void sum(Cmplx1 c1,Cmplx1 c2)
{
cout<<"\n\t\tRESULT : ";
cout<<"\n\n\t["<
cout<<" ] + [ "<
cout<<" ] = "<
}
void main()
{
Cmplx1 op1,op2;
clrscr();
cout<<"\n\n\tADDITION OF TWO COMPLEX NUMBERS USING FRIEND FUNCTIONS\n\n";
cout<<"\n\tINPUT\n\n\t\t OPERAND 1";
op1.get();
cout<<"\n\n\t\t OPERAND 2";
op2.get();
sum(op1,op2);
getch();
}

FUNCTION OVERLOADING:




#include
#include
#include
#define pi 3.14
class fn
{
      public:
        void area(int);  //circle
        void area(int,int);  //rectangle
        void area(float ,int,int);  //triangle
};

void fn::area(int a)
{
      cout<<"Area of Circle:"<
}
void fn::area(int a,int b)
{
      cout<<"Area of rectangle:"<
}
void fn::area(float t,int a,int b)
{
      cout<<"Area of triangle:"<
}



void main()
{
     int ch;
     int a,b,r;
     clrscr();
     fn obj;
     cout<<"\n\t\tFunction Overloading";
     cout<<"\n1.Area of Circle\n2.Area of Rectangle\n3.Area of Triangle\n4.Exit\n:”;
     cout<<”Enter your Choice:";
     cin>>ch;

     switch(ch)
     {
              case 1:
                cout<<"Enter Radious of the Circle:";
                cin>>r;
                obj.area(r);
                break;
              case 2:
                cout<<"Enter Sides of the Rectangle:";
                cin>>a>>b;
                obj.area(a,b);
                break;
              case 3:
                cout<<"Enter Sides of the Triangle:";
                cin>>a>>b;
                obj.area(0.5,a,b);
                break;
              case 4:
                exit(0);
     }
getch();
}




HYBRID INHERITANCE:



#include
#include
class student
{
protected:
int roll_number;
public:
void get_number(int a)
{
roll_number=a;
}
void put_number(void)
{
cout<<"Roll No.: "< }
};
class test:public student
{
protected:
float part1, part2;
public:
void get_marks (float x, float y)
{
part1=x;
part2=y;
}
void put_marks(void)
{
cout<<"Marks obtained: \n";
cout<<"Part1="< cout<<"Part2="< }
};
class sports
{
protected:
float score;
public:
void get_score(float s)
{
score=s;
}
void put_score(void)
{
cout<<"Sports wt: "< }
};
class result : public test, public sports
{
float total;
public:
void display(void);
};
void result::display(void)
{
total=part1+part2+score;
put_number();
put_marks();
put_score();
cout<<"Total Score: "<}
int main()
{
result student_1;
student_1.get_number(1234);
student_1.get_marks(27.5,33.0);
student_1.get_score(6.0);
student_1.display();
return 0;
}


INHERITANCE STUDENT CLASS:



#include
#include

using namespace std;

class Person {
public:
      Person(string name, int age) {
            this->name = name;
            this->age = age;
      }
      string getName() {
            return name;
      }
      int getAge() {
            return age;
      }
private:
      string name;
      int age;
};

class Student : public Person
{
public:
      Student(string name, int age, float grade) : Person(name, age) {
            this->grade = grade;
      }
      float getGrade() {
            return grade;
      }
private:
      float grade;
};

int main() {
      cout << "Creating a student Class..." << endl;
      Student johnDoe("XYZ", 30, 5.0);
      cout << "Student's name: " << XYZ.getName() << endl;
      cout << "Student's age: " << XYZ.getAge() << endl;
      cout << "Student's grade: " << XYZ.getGrade() << endl;

      return 0;
}


OVERLOAD STRING CLASS:



#include
#include
using namespace std;
class String
 {
  char *str;
public:
  String();
  String(const char *s);
  String(const String& s);
  void setString(const char *s);
  void setString(const String& s);
  int stringLength() const;
  char *getString() const;
  String& operator=(const String& s);
};
String::String()
{
  str = 0;
}
String::String(const char *s)
{
  str = new char[strlen(s) + 1];
  strcpy(str, s);
}
String::String(const String& s)
{
  str = new char[strlen(s.str) + 1];
  strcpy(str, s.str);
}
void String::setString(const char *s)
{
  setString(String(s));
}
void String::setString(const String& s)
{
  *this = s;
}
int String::stringLength() const
{
  return strlen(str);
}
char *String::getString() const
{
  return str;
}
String& String::operator=(const String& s)
{
  char *temp = new char[strlen(s.str) + 1];
  strcpy(temp, s.str);
  delete [] str;
  str = temp;
  return *this;
}
String operator+(const String& a, const String& b)
{
  char *temp = new char[a.stringLength() + b.stringLength() + 1];
  strcpy(temp, a.getString());
  strcat(temp, b.getString());
  return String(temp);
}
int main()
{
  String s1 = "Hello World";
  String s2;
  s2.setString("This is a string");
  cout<<"string 1 is "<< s1.stringLength() <<" characters long"<
  cout<<"string 1 is "<< s1.getString() <<'\n';
  cout<<"string 2 is "<< s2.getString() << endl <
  cout<<"assign string 2 to string 1"<
  s1.setString(s2);
  cout<<"string 1 is "<< s1.getString() <
  return 0;
}


SUM & AVERAGE of TWO INTEGERS: 


#include
#include

using namespace std;

int main (int argc, char *argv[])
{
    int num[100];
    int n;
    register int i;
    int sum = 0;
    float avg;
    cout << "Enter number of items in array: ";
    cin >> n;
    for (i = 0; i < n; i++)
    {
        cout << "Enter the " << i+1 << "th number: ";
        cin >> num[i];
        sum += num[i];
    }
    avg = (float) sum/n;
    cout << "Sum is " << sum << "\nAnd Average = " << avg;
    getch();
}


VIRTUAL CLASS:


#include
#include
class base
{
    public:
      virtual void show()
      {
                cout<<"\n  Base class show:";
      }
      void display()
      {
              cout<<"\n  Base class display:" ;
      }
};
 
class drive:public base
{
   public:
      void display()
      {
              cout<<"\n  Drive class display:";
      }
      void show()
      {
              cout<<"\n  Drive class show:";
      }
};
 
void main()
{
   clrscr();
   base obj1;
   base *p;
   cout<<"\n\t P points to base:\n"  ;
 
   p=&obj1;
   p->display();
   p->show();
 
   cout<<"\n\n\t P points to drive:\n";
   drive obj2;
   p=&obj2;
   p->display();
   p->show();
   getch();
}





C Programs


Addition, Subtraction, Division and Multiplication


#include

main()
{
   int first, second, add, subtract, multiply;
   float divide;

   printf("Enter two integers\n");
   scanf("%d%d", &first, &second);

   add = first + second;
   subtract = first - second;
   multiply = first * second;
   divide = first / (float)second;   //typecasting

   printf("Sum = %d\n",add);
   printf("Difference = %d\n",subtract);
   printf("Multiplication = %d\n",multiply);
   printf("Division = %.2f\n",divide);

   return 0;
}


Binary, Octal, hexadecimal



#include
#include
void main()
{
int i,num,*bin,*oct,bin_len,oct_len,hex_len;
char *hex,ch;
clrscr();
do
{
printf("\n Enter the number to be converted :");
scanf("%d",&num);
//printf("\n%c\n",(char)48);
printf("\n");
//binary
bin_len=binary(bin,num);
printf("\nBinary : ");
for(i=0;i
printf("%d",bin[i]);
printf("\n");

//octal
oct_len=octal(oct,num);
printf("\nOctal : ");
for(i=0;i
printf("%d",oct[i]);
printf("\n");

//hexadecimal
hex_len=hexadecimal(hex,num);
printf("\nHexadecimal : ");
for(i=0;i
printf("%c",hex[i]);
printf("\n");

      printf("\nEnter another number(y/n)?");
      ch=getche();
                                getch();
}
while(ch!='n');
}
int binary(int *bin,int num)
{
int rem=0,i=0;
     do
{
     rem=num%2;
     num=num/2;
     bin[i]=rem;
     i++;
     }
while(num>0);
array_reverse_i(bin,i);
return i;
}
int octal(int *oct,int num)
{
int rem=0,i=0;
     do
{
     rem=num%8;
     num=num/8;
     oct[i]=rem;
     i++;
     }
while(num>0);
array_reverse_i(oct,i);
return i;
}
int hexadecimal(char *hex,int num)
{
int rem=0,i=0;
    do
{
     rem=num%16;
     num=num/16;
     switch (rem)
                {
                case 10 : hex[i]='A';
                                 i++;
                                 break;
                case 11 : hex[i]='B';
                                 i++;
                                 break;
                case 12 : hex[i]='C';
                                 i++;
                                 break;
                case 13 : hex[i]='D';
                                 i++;
                                 break;
                case 14 : hex[i]='E';
                                 i++;
                                 break;
                case 15 : hex[i]='F';
                                 i++;
                                 break;

                default :hex[i]=(char)(rem+48);
                                 i++;
 }
}
while(num>0);
array_reverse_c(hex,i);
return i;
}
array_reverse_i(int *arr,int len)
{
int i,temp;
for(i=0;i
 {
   temp=arr[i];
   arr[i]=arr[len-1-i];
   arr[len-1-i]=temp;
  }
return 0;
}
array_reverse_c(char *arr,int len)
{
int i;
char temp;
for(i=0;i
 {
   temp=arr[i];
   arr[i]=arr[len-1-i];
   arr[len-1-i]=temp;
 }
return 0;
}


BINARY SEARCH




#include
#include
void main()
{
int n,i,search,f=0,low,high,mid,a[20];
clrscr();
printf("Enter the n value:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("Enter the number in ascending order a[%d]=",i);
scanf("%d",&a[i]);
}
printf("Enter the search element:");
scanf("%d",&search);
low=1;
high=n;
while(low<=high)
{
mid=(low+high)/2;
if(search
{
high=mid-1;
}
else if(search>a[mid])
{
low=mid+1;
}
else
{
f=1;
printf("obtainedin the position %d:",mid);
getch();
exit();
}
}
if(f==0)
{
printf("not present");
}
getch();
}


CONCATENATE STRING



#include
#include
#include

main()
{
   char a[100], b[100];

   printf("Enter the first string\n");
   gets(a);

   printf("Enter the second string\n");
   gets(b);

   strcat(a,b);

   printf("String obtained on concatenation is %s\n",a);

   getch();
   return 0;
}

EVEN ODD



#include
#include
void main()
{
int i;
clrscr();
printf("enter no ");
scanf("%d",&i);
if(i%2==0)
printf("no is even");
else
printf("no is not even");
getch();
}


FACTORIAL


//WAP To Print n!.

#include
void Factorial(int);

void main()
{
int num;

clrscr();
printf("Enter a Number");
scanf("%d",&num);

Factorial(num);
getch();
}

void Factorial(int num)
{
int i;
long fact=1;

for(i=1;i<=num;i++)
fact*=i;
printf("\nFactorial of %d is %d",num,fact);
}


FIBONACCI 



#include
#include
void main()
{
 int n;
 long int i;
 long int fibo(int n);
 clrscr();
 printf("Enter the limit:\n");
 scanf("%d",&n);
   i=fibo(n);
 printf("\nThe %dth Fibonacci number is %ld",n,i);
 getch();
}

long int fibo(int n)
{
 int old_no,currnt_no,sum,i;
   i=1;
   old_no=0;
   currnt_no=1;
   while(i<=n)
   {
      sum=old_no+currnt_no;
      old_no=currnt_no;
      currnt_no=sum;
      i++;
      printf("\n%d",sum);
   }
 return(sum);
}


fprintf() and fscanf() Function


#include
#include
#include

int main(void)
{
  FILE *fp;
  char s[80];
  int t;

  if((fp=fopen("test", "w")) == NULL) {
    printf("Cannot open file.\n");
    exit(1);
  }

  printf("Enter a string and a number: ");
  fscanf(stdin, "%s%d", s, &t); /* read from keyboard */

  fprintf(fp, "%s %d", s, t); /* write to file */
  fclose(fp); 

  if((fp=fopen("test","r")) == NULL) {
    printf("Cannot open file.\n");
    exit(1);
  }

  fscanf(fp, "%s%d", s, &t); /* read from file */
  fprintf(stdout, "%s %d", s, t); /* print on screen */

  return 0;
}


LEAP YEAR


#include
int main()
{
int year;
int  min_year,max_year;
printf("enter lowest year");
scanf("%d", &min_year);
printf("enter highest year");
scanf("%d", &max_year);
printf("leap year in given range");
for( year=min_year; year<=max_year; year++)
{
if (((year%4==0) && (year<=100!=0)) || (year%400==0))
printf("%d",year);
}
return 0;
}


LENGTH OF STRING


#include
int StringLength(char[]);

void main()
{
     char n[20];
     int length;

     clrscr();
     printf("Enter a String: ");
     gets(n);

     length=StringLength(n);
     printf("\nLength of String \"%s\": %d",n,length);
     getch();
}

int StringLength(char n[])
{
int cnt=0;

while(n[cnt]!='\0')
  cnt++;

//cnt=strlen(n);
return cnt;
}


LINKED LIST



Program to demonstrate linked list operations

# include
# include
# include "malloc.h"
struct node
{
int data;
struct node *link;
};

void main()
{
int a=111,b=2,c=3,will,wish,num;
struct node *ptr,*ptr2,*result,*temp;
void add(struct node **,int );
struct node * search(struct node *);
void display(struct node *);
void invert(struct node *);
void del(struct node *,int);
struct node * concat(struct node *,struct node *);
ptr=NULL;
ptr2=NULL;
result=NULL; //result for storing the result of concatenation
clrscr();
will=1;

while(will==1)
{
printf("

Main Menu 
1. Add element
2.Delete element
3.Search element
4Linked List concatenation
5.Invert linked list
6. Display elements 
Please enter the choice");
scanf("%d",&wish);
switch(wish)
{
case 1:
printf("
Enter the element you want to add   ");
scanf("%d",&num);
add(&ptr,num);
display(ptr);
break;
case 2:
printf("
Enter the element to delete ");
scanf("%d",&num);
del(ptr,num);
break;
case 3:
printf("
 Now demonstrating search ");
temp = search(ptr);
printf("
Address of first occurence is  %u ",temp);
break;
case 4:
/* Inputs given internally for demo only */
printf(" Now demonstrating linked list concatenation
 Press any key to continue...");
add(&ptr2,2);
add(&ptr2,4);
add(&ptr2,6);
getch();
printf("

 Displaying second Linked List


");
display(ptr2);
getch();
result = concat(ptr,ptr2);
clrscr();
printf("



Now Displaying the result of concatenation");
display(result);
getch();
break;
case 5:

printf("
 Inverting the list ...
Press any key to continue...");
invert(ptr);
break;
case 6:
display(ptr);
break;
default:
printf("

 Illegal choice

");
}
printf("
 DO you want to continue ( press 1 for yes ");
scanf("%d",&will);
} //end of while
}


void add(struct node **q,int num)
{
struct node *temp;
temp = *q;
if(*q==NULL)
{
*q=malloc(sizeof(struct node));
temp = *q;
}
else
{
while((temp->link)!=NULL)
{
temp=temp->link;
}
temp->link = malloc(sizeof(struct node));
temp=temp->link;
}
temp->data = num;
temp->link  = NULL;
}

void display(struct node *pt)
{

while(pt!=NULL)
{

printf("

 Data : %d",pt->data);
printf("
 Link : %d",pt->link);
pt=pt->link;
}
}


void invert(struct node *ptr)
{

struct node  *p,*q,*r;
p=ptr;
q=NULL;

while(p!=NULL)
{
r=q;
q=p;
p=p->link;
q->link=r;
}
ptr = q;
display(ptr);
}


// CONCATENATION OF LINKED LISTS

struct node * concat(struct node *p,struct node *q)
{
struct node *x,*r;


if (p==NULL)
r=q;

if (q==NULL)
r=p;
else
{
      x=p;
      r=x;
      while(x->link!=NULL)
x=x->link;
      x->link=q;
}
    return(r);
}


// SEARCHING AN ELEMENT IN THE LINKED LIST
// THIS FUNCTION FINDS THE FIRST OCCURENCE OF
// A DATA AND RETURNS A POINTER TO ITS ADDRESS

struct node * search(struct node *p)
{
struct node *temp;
int num;
temp = p;
printf("
 Enter the data that you want to search    ");
scanf("%d",&num);
printf(" 
 Link of temp %u", temp->link);
while(temp->link!=NULL)
{
printf(" 
 In while ");
if(temp->data == num)
return(temp);
temp=temp->link;
}
return(NULL);
}



// DELETING DATA FROM THE LINKED LIST//

void del(struct node *p,int num)
{

struct node *temp,*x;
temp=p;
x= NULL;

while (temp->link !=NULL)
{
if(temp->data == num)
{
if (x==NULL)
{
p = temp->link;
free(temp);
return;
}
else
{
x->link = temp->link;
free(temp);
return;
}
}                  //end of outer if
x=temp;
temp=temp->link;
} //end of while
printf(" 

No such entry to delete ");
} //end of fn.



Multiplication table



#include
int main(){
  int r,i,j,k;
  printf("Enter the number range: ");
  scanf("%d",&r);
  for(i=1;i<=r;i++){
      for(j=1;j<=10;j++)
           printf("%d*%d=%d ",i,j,i*j);
      printf("\n");
  }
  return 0;
}


Pascal triangle


#include

long fact(int);
int main(){
    int line,i,j;

    printf("Enter the no. of lines: ");
    scanf("%d",&line);

    for(i=0;i
         for(j=0;j
             printf(" ");

         for(j=0;j<=i;j++)
             printf("%ld ",fact(i)/(fact(j)*fact(i-j)));
         printf("\n");
    }
    return 0;
}

long fact(int num){
    long f=1;
    int i=1;
    while(i<=num){
         f=f*i;
         i++;
  }
  return f;
 }



PASCAL TRIANGLE


#include
#include
void main()
{
int i,n,j,k,l;
clrscr();
printf("Enter a value of n");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=1;j<=(40-i);j++)
{
printf("  ");
for(k=1;k<=i;k++)
{
printf("%d",k);
}
for(l=80;l<=(i-1);i--)
{
printf("%d",l);
}
}
printf("\n");
}
getch();
}


PRIME NUMBER


#include
#include
#include

void main()
{
int a,i,r;
clrscr();
printf("enter num.");
scanf("%d",&a);
i=2;
while(i
{
           r=a%i;
           if(r==0)
           {
                   printf("given num. is not prime");
                   break;
           }
      i=i+1;
     }
     if(i==a)
{
            printf("given num. is prime");
}

getch();
}


SMALLEST ELEMENT IN ARRAY


#include
main() 
{
    int array[100], *minimum, size, c, location = 1;
    printf("Enter the number of elements in array\n");
    scanf("%d",&size);
 
    printf("Enter %d integers\n", size);
 
    for ( c = 0 ; c < size ; c++ )
        scanf("%d", &array[c]);
 
    minimum = array;
    *minimum = *array;
    for ( c = 1 ; c < size ; c++ ) 
    {
        if ( *(array+c) < *minimum ) 
        {
           *minimum = *(array+c);
           location = c+1;
        }
    } 
 printf("Minimum element is present at location number %d and it's value is %d.\n", location, *minimum);
    return 0;
}


SUM OF FACTORIAL


#include
#include
long int calfact(int x);
void main()
{
 int i,x,limit;
 float sum=0;
 char c;
 clrscr();
 repeat :
 printf("enter the limit:\n");
 scanf("%d",&limit);
    for(i=1;i<=limit;i++)
    {
      sum=sum+((float)i/calfact(i));
      printf("\nsum of %d is %f\n",i,sum);
    }
      printf("\nfinally the sum of %d is %f",limit,sum);
      fflush(stdin);
       printf("\n\nDo you wish to Continue(y/n)");
       scanf("%c",&c);
       if(c=='y'||c=='Y')
       goto repeat;
 getch();
}
long int calfact(int x)
 {
  if(x<=1)
    {
     return(1);
    }
  else
    {
     x=x*calfact(x-1);
     return(x);
    }
}




Just Type The Keyword To Search Your Answer -- >>