Note 1

Take Note:

Take a note while surfing.





Note With Ink

Give your Note a Colorful Tag.




Easy to Access

Stay on same information and in Sync wherever you are.

Note 2

Take Note:

Organize your information,It may take Shape.





Think With Ink

Differ your Content by Color.




Easy to Access

Easy to pull up your content from anywhere anytime.

Note 3

Take Note:

Don't Let information to miss,Because it take shape





Note With Ink

Simple an Easy Way to take a note.




Easy to Access

Get the same in next visit.

Programs Questions and Answers



  • 61. Write a program to find the given number is even or odd.
    
    INPUT: 14
    OUTPUT: Even
    
    
    INPUT: 13
    OUTPUT: Odd

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include <iostream>
    using namespace std;
    int main()
    {
        int n;
        cout << "Enter an integer: ";
        cin >> n;
        if ( n % 2 == 0)
            cout << n << " is even.";
        else
            cout << n << " is odd.";
        return 0;
    }
    Tags:

    Wipro Syntel Inc. 

  • 62. Write a program to create a calculator using switch cases.

    Input : ,   Output :

  • Answer In: C   C++  
     
    # include <iostream>
    using namespace std;
    int main()
    {
        char op;
        float num1, num2;
        cout << "Enter operator either + or - or * or /: ";
        cin >> op;
        cout << "Enter two operands: ";
        cin >> num1 >> num2;
        switch(op)
        {
            case '+':
                cout << num1+num2;
                break;

            case '-':
                cout << num1-num2;
                break;

            case '*':
                cout << num1*num2;
                break;

            case '/':
                cout << num1/num2;
                break;

            default:
                /* If the operator is other than +, -, * or /, error message is shown */
                cout << "Error! operator is not correct";
                break;
        }
        return 0;
    }
    Tags:

    Wipro 

  • 63. Write a program to check a String is palindrome or not? How many minimum number of control variable you need.

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include <iostream>
    using namespace std;
    int main(){
        char string1[20];
        int i, length;
        int flag = 0;
        cout << "Enter a string: "; cin >> string1;    
        length = strlen(string1);    
        for(i=0;i < length ;i++){
            if(string1[i] != string1[length-i-1]){
                flag = 1;
                break;
           }
        }    
        if (flag) {
            cout << string1 << " is not a palindrome" << endl; 
        }    
        else {
            cout << string1 << " is a palindrome" << endl; 
        }
        system("pause");
        return 0;
    }
    Tags:

    Wipro Virtusa 

  • 64. Write a program to reverse a string using minimum control variable and minimum iteration and with and without  temporary variable.

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include<iostream.h>
    #include<conio.h>
    #include<stdio.h>
    void main()
    {
        clrscr();
        char str[100], temp;
        int i=0, j;
        cout<<"Enter the String : ";
        gets(str);
        i=0;
        j=strlen(str)-1;
        while(i<j)
        {
            temp=str[i];
            str[i]=str[j];
            str[j]=temp;
            i++;
            j--;
        }
        cout<<"Reverse of the String = "<<str;
        getch();
    }
    Tags:

    Wipro 

  • 65. Write a program to print pattern of numbers as below:
    
     1
    121
    12321

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    <!DOCTYPE html>
    <html>
    <body>

    <?php 
    function Pattern()
    {
    $n=5;
     for(
    $i=1;$i<=$n;$i++)
            {
                
    $c=$i-1;
                for(
    $j=0;$j<(2*$i+1);$j++)
                {
                    if(
    $i>=$j)
                    {
                       echo 
    $j;
                    }
                    else
                    {
                       echo 
    $c;
                        
    $c--;
                    }
                } echo 
    "<br/>";
            } 
            echo 
    "<br/>";
    }
    Pattern();
    ?> 

    </body>
    </html>
    Tags:

    Wipro 

  • 66. Write code for swapping two variables without using 3rd variable.

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include<stdio.h>
    #include<conio.h>
    # include <iostream>
    using namespace std;
    main()
    {
    int a=10, b=20;
    clrscr();
    cout<<"Before swap is:"<<a<<"\t"<<b;
    a=a+b;//a=30 (10+20)
    b=a-b;//b=10 (30-20)
    a=a-b;//a=20 (30-10)
    cout<<"\nAfter swap" <<a<<"\t"<<b;
    getch();
    }
    Tags:

    Wipro TCS Syntel Inc. 

  • 67. Write a program to print prime numbers upto 10.

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include<stdio.h>
    # include <iostream>
    using namespace std;
    void main()
    {
         int n,i,j,ct=0; 
        cout << "Enter any number \n";
         cin>>n;
         cout << " All prime numbers are -\n";
         for(i=2;i<=n;i++)
         {
                 ct=0;
                 for(j=2;j<i;j++)
                 {
                         if(i%j==0)
                         {
                                   ct=1;
                                   break;
                         }
                 }
                 if(ct==0)
                 {
                     cout << i;
                 }
         }
         getch();
    }
    Tags:

    Wipro TCS Syntel Inc. 

  • 68. Write a program to check Armstrong number.

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include <stdio.h>
    #include <math.h>
    # include <iostream>
    using namespace std; 
    void main()
    {
        int number, sum = 0, rem = 0, cube = 0, temp; 
        cout <<"enter a number";
        cin>>number;
        temp = number;
        while (number != 0)
        {
            rem = number % 10;
            cube = pow(rem, 3);
            sum = sum + cube;
            number = number / 10;
        }
        if (sum == temp)
           cout <<"The given no is armstrong no";
        else
            cout <<"The given no is not a armstrong no";
    }
    Tags:

    Wipro Syntel Inc. 

  • 69. Write a program to print reverse of a number?

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include <stdio.h>
    
    # include <iostream>
    using namespace std;
    int main()
    {
        int n, reversedNumber = 0, remainder;
       cout <<"Enter an integer: ";
        cin>>n;
        while(n != 0)
        {
            remainder = n%10;
            reversedNumber = reversedNumber*10 + remainder;
            n /= 10;
        }
      cout <<"Reversed Number = "<<reversedNumber;
        return 0;
    }
    Tags:

    Wipro Syntel Inc. 

  • 70. Write a program to check whether the entered year is leap year or not?

    Input : ,   Output :

  • Answer In: C   C++   PHP  
     
    #include <stdio.h>
    # include <iostream>
    using namespace std;
    int main()
    {
        int year;
        cout <<"Enter a year: ";
        cin>>year;
        if(year%4 == 0)
        {
            if( year%100 == 0)
            {
                /* year is divisible by 400, hence the year is a leap year */
                if ( year%400 == 0)
                    cout << year<<"is a leap year."<< year;
                else
                   cout<< year <<" is not a leap year."<<year;
            }
            else
                cout<< year <<" is a leap year."<< year;
        }
        else
            cout<< year <<" is not a leap year." <<year;
        getch();
        return 0;
    }
    Tags:

    Wipro