Friday, 30 September 2016

Ready for Lab exam !!!!!! 

    Gear up !!!!!


Here are some must know questions:


1. Problem on reversal of string or part of string

2. Binary hexa decimal conversion ( all similar conversion)

3. Problem on traversal of an array ( in easy question)

4. General file handling program (simple reading and writing of data )

5. Anagram string 

6. Printing of patterns ( practice diamond printing)

7. Printing armstrong,special  number ( simple follow the logic )

8. Finding frequency of given substring in a given string 

9.Standard problems on recursion like

     gcd,reversing string,printing max and min of array,searching of an element

10. all sorting technique taught.



Practice coding these questions from scratch , once you understand them properly you will be able to solve atleast the 80 marks question.


Please comment if you want anything to be discussed . Help yourself and your friends , learning from peers is the best.

Keep visiting for further updates. More problems will be discussed.

Friday, 2 September 2016

Question: Big integer addition with array of integer as input .


Solution :

// I have used different syntax for ip/op, you can use scanf / printf instead .
//big integer addition program  without test case and array input

#include<stdio.h>

#include<iostream>

using namespace std;


int main()

{

    int a[100],b[100];

    int c[100],m,n;

    cin>>m;

    cin>>n;

    int i,j;

    int newpos=0;

    for( i=0;i<m;i++)

    {

        cin>>a[i];

       

    }

    for( j=0;j<n;j++)

    {

        cin>>b[j];

    }

   

    int sum,carry=0;

   

    for( i=m-1,j=n-1;i>=0,j>=0;i--,j--)

    {

        sum=a[i]+b[j]+carry;

        c[newpos++]=sum%10;

        carry=sum/10;

         

    }

    for(;j>=0;j--)

    {

        sum=b[j]+carry;

        c[newpos++]=sum%10;

        carry=sum/10;

       

    }

    for(;i>=0;i--)

    {

        sum=a[i]+carry;

        c[newpos++]=sum%10;

        carry=sum/10;

       

    }


    if(carry>0)

    {

        c[newpos++]=carry;

       

    }

    //reversing the array

    for(i=newpos-1;i>=0;i--)

    {

        cout<<c[i];

    }

    cout<<"\n";


}

Thursday, 1 September 2016

Welcome to the world of writing C program  on piece of paper .

Isn't it funny? 


But you have to do it now in your Mid semester exam.


Some Do's and dont's

 

1. Practice all programs given in tutorials by writing on piece of a paper.

2. Focus on syntax of the language . Never miss out the semicolons.

3. In theory paper marks are divided on both syntax and logic .

4. Always attempt the problem and write your logic even though it may be not correct on the paper.

5. The paper will consist of easy , moderate and difficult questions.

6. Be quick and accurate in easy programs ( these are problems directly related to tutorial problems).

7.Moderate questions are slight modification of easy problems .

8. Don't worry , only 1 or 2 hard questions are there  in which logic part is only tricky.

9.Try writing syntaxes on piece of paper.

 

and AT LAST ONLY HARD WORK PAYS FOR NOW.

 

Bye for now, next post will be about strings and 2 d array .

 

Comment for a topic which you want to discuss. (You can use pseudonames) .