Posts

Showing posts from October, 2021

If else problems with solution

   // date --> 09-10-2021    // if esle exercise              // // difference between signed and unsigned int ; // unsigned int num = -1; // int x = num; // cout<<num<<", "<<x; /*//Q- Take valuse of length and breadth   of a rectangle from user and check if it is square or not . int length, breadth ; cout<<"Enter the lenght of the rectangle : "<<endl; cin>>length; cout<<"Enter the breadth of the rectangle : "<<endl; cin>>breadth; if (length==breadth){   cout<<"It is a square"<<endl; }else{  ...

c++ program to check odd or even | to find size of data types | to sum of three numbers | increment and decrement operators | learnig cpp

  /* Write a c++ program to print the of n natural number.   int n, table;   cout<<"Enter the number that you want to print the table of : ";   cin>>n;    for (table = 1; table <11; table++){      int sum = n*table ;      cout<<sum<<endl;    } */    /*Write a program to check whether the number is odd or even?    int n, remainder;    cout<<"Enter your  number to check: " <<endl;    cin>>n;    remainder =n%2;    if (remainder == 0 ){  ...

c++ basic question

  #include   <iostream> using   namespace   std ; int   main (){   /*   Q- Write a program where the user is asked to enter two integers  ( divisor and dividend)   and the quotient and the remainder of their divison is computed . ( Both divisor and dividend should be integers).         int dividend, divisor, quotient , remainder;   cout<<"Enter your dividend : ";  cin>>dividend;   cout<<"Enter your divisor : "; cin>>divisor; quotient = dividend/divisor; remainder = dividend%divisor; cout<<"The quotient is : "<<quotient<<endl <<"The rema...

c++ programming is fun to learn

  #include   <iostream> using   namespace   std ; int   main ()  {   /*//int age; cout<<"Enter your age "; cin>>age; //if else if(age<18){   cout<<"You cannot vote!"; } else{   cout<<"You can vote!! "; } */ //switch statement int   age  ; cout<< "Enter your age ! " ; cin>> age ; switch  ( age ) { case   1 :    cout<< "waris raza " ;    break ;       case   2 :   cout<< "mufti sahab" ;    break ;    case   3 :   cout<< "Azhar chchajan" ;    break ; default : cout<< "hasi bhaijaan" ;    break ; } return   0 ; }    

learning c++ is fun

  #include   <iostream> using   namespace   std ; int   main ()  {    /*Q- Write a  c++ program to input a dividend and divisor and calculate and display     the quotient and remainder     */  /* int divisor, dividend,quotient,remainder;   cout<<"Enter the dividend" <<endl;   cin>>dividend;   cout<<"Enter the divisor" <<endl;   cin>>divisor;   quotient = dividend/divisor;   cout<<"Quotient: "<<quotient <<endl;   remainder = dividend % divisor;   cout<<"Remainder: "<<remainder;*/ /* Write the c++ program to calculate the area of...