Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I want the long code to be described like the code in the following example: #in

ID: 3789523 • Letter: I

Question

I want the long code to be described like the code in the following example:

#include

using namespace std;

int main ()

{

//vairable declarations

CONST double pi=3.1415; //constant used for circle calculations

double radius; //the radius of a circle entered by user

double circcumference; //circumference of a circle calculated from radius

double area; //the area of a cricle calculated from radius

//prompt user for radius

cout<<"enter radius of a circle:";

cin>> radius;

//calculate circumference and area

circumference = pi*2*radius;

area = pi*radius*radius;

//display to user

cout<<"The circumference is"<

//done

return 0;

}

Here is the code that needs to be described. Describe each function breifly or its purpose using //

#include
using namespace std;
int main()
{
int n;
cout<<"enter a 3 digit positive number:";
cin>>n;

if(n<100 || n>999)
{
cout<<" "<

else
{
cout<<" divisible by 2: ";
cout<<"If the integer ends in a digit that is divisible by 2 then the integer is divisible by 2. Does it end in a 0, 2, 4, 6, or 8? ";
if(n%10==0 ||n%10==2||n%10==4||n%10==6||n%10==8)
{
cout<<" Yes, the integer ends in a "<

else
{
cout<<" No, the integer ends in a "<

cout<<" divisible by 3: ";
cout<<"For number efg, find e+f+g. For number gh, find g+h. Continue until you get a single digit value. If the single digit is divisible by 3 then the integer is divisible by 3. Is the single digit value a 3, 6, or 9? ";
int sum=0,num=n;

sum = (num%10) + (num/10)%10 + (num/100);

if(sum>9)
{
sum = (sum/10) + (sum%10);
}

if(sum==3||sum==6||sum==9)
{
cout<<"Yes, the single digit value is "<

else
cout<<"No, the single digit value is "<

cout<<" Divisible by 5: If the integer ends in a digit divisible by 5, then the integer is divisible by 5. Does it end in a 0 or 5?";
if(n%10==0||n%10==5)
cout<<" Yes, the integer ends in a "<


if(sum7==0||sum7==7)
cout<<" Yes, the single digit value is "<

if(sum9>9)
{
sum9 = (sum9/10) + (sum9%10);
}

if(sum9==9)
cout<<" Yes, the single digit value is "<

}

Explanation / Answer

Example code:-

#include <iostream>
#include <stdlib.h>
using namespace std;

int main ()
{
   //vairable declarations
   const double pi=3.1415; //constant used for circle calculations
   double radius; //the radius of a circle entered by user
   double circumference; //circumference of a circle calculated from radius
   double area; //the area of a cricle calculated from radius
   //prompt user for radius
   cout<<"enter radius of a circle:";
   cin>> radius;
   //calculate circumference and area
   circumference = pi*2*radius;
   area = pi*radius*radius;
   //display to user
   cout<<"The circumference is " << circumference << " ";
   cout<<"The area is " << area << " ";

       //done
       //return 0;
   system("pause");
}

Actule code Divided by 2,3,5,7,9 with explanition.

#include <iostream>
#include <stdlib.h>
using namespace std;

int main()
{
   int n;
   //prompt user for 3 digit positive number
   cout<<"enter a 3 digit positive number:";
   cin>>n;
   if(n<100 || n>999)
   {
       cout<<" ";
   }
   else
   {
       //print the Description in command prompt explaination of divisible of 2
       cout<<" divisible by 2: ";
       cout<<"If the integer ends in a digit that is divisible by 2 then the integer is divisible by 2. Does it end in a 0, 2, 4, 6, or 8? ";

       //condition for divisible of 2
       //if n module(%) with 10, then reminder is equal with 0 or 2 or 4 or 6 or 8 then the number is divisible with 2.
       if(n%10==0 ||n%10==2||n%10==4||n%10==6||n%10==8)
       {
           //if condition true the print the text in command prompt
           cout<<"Yes, the integer ends with " << n%10 << " ";
       }

       //if the number not divisible with 2 then come to else block
       else
       {
           //print the Description in command prompt explaination of divisible of 2
           cout<<"No, the integer ends in 2, 4, 6, 8, 0 ";
           cout<<" divisible by 3: ";
           cout<<"For number efg, find e+f+g. For number gh, find g+h. Continue until you get a single digit value. If the single digit is divisible by 3 then the integer is divisible by 3. Is the single digit value a 3, 6, or 9? ";
          
           //initilize the sum and num and assign the n to num.
           int sum=0,num=n;
           //divisible by 3 is the indivisible sum of the number can divided by 3.
           //sum the indivisible digitsof the number.
           sum = (num%10) + (num/10)%10 + (num/100);

           //if sum greater then 9
           if(sum>9)
           {
               //againg adding the indivisible digitsof the number.
               sum = (sum/10) + (sum%10);
           }

           //if check the sum equal to 3, 6, 9
           if(sum==3||sum==6||sum==9)
           {
               //if condition true the print the text in command prompt
               cout<<"Yes, the single digit value is " << sum << " ";
           }
           else{
               //divisible by 5.
               cout<<"No, the single digit value is not in 3, 6, 9 ";
               cout<<" Divisible by 5: If the integer ends in a digit divisible by 5, then the integer is divisible by 5. Does it end in a 0 or 5?";
               //if n module(%) with 10, then reminder is equal with 0 or 5, then the number is divisible with 2.
               if(n%10==0||n%10==5)
                   cout<<" Yes, the integer ends in " << n%5 << " ";

               //divisible by 7.
               //if n module(%) with 7, then reminder is equal with 0, then the number is divisible with 2.
               if(n%7 == 0)
                   cout<<" Yes, the single digit value is is divided by 7";

               //divisible by 9.
               //if n > 9.
               if(n > 9)
               {
                   //sum the indivisible digitsof the number.
                   sum = (n/10) + (n%10);
               }

               if(sum==9)
                   cout<<" Yes, the single digit value is " << sum;
           }
       }
   }
   system("pause");
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote