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

plEASE PROVIDE ****FLOW CHART AND PROGRAM*** Programming Assignment Please submi

ID: 3676180 • Letter: P

Question

plEASE PROVIDE ****FLOW CHART AND PROGRAM***

Programming Assignment

Please submit:

1. Flowchart of your program. (4 points)

2. Printout of your C++ program with a heading comment (Do not forget to add proper indentation and spacing as well as comments within your program). (4 points)

3. Copy of two screenshots after your program is executed. (First: Enter your student ID. Second: If your student ID is divisible by 2 to 10, enter 23456789. If your student ID is not divisible by 2 to 10, enter your student ID + 1.) (2 points)

Programming Assigment

Purpose of the program : Create a program that check the entered number is divisible by 2 to 10.

Section 1 Request / Enter a number (Student ID).

Section 2 If the entered number is divisible by 2, state the fact. Check if the entered number is divisible by a number up to 10. (Hint: Use if statements.)

Section 3 If the entered number is not divisible by 2 to 10, state the fact. (Hint: Use a variable to keep track a condition.)

Explanation / Answer

#include<iostream>
using namespace std;
int main()
{
int n,i=2,a[15],j=0;
a[0]=0;

cout<<"Pleas Enter Student ID without L: ";
cin>>n;

while(i<=10)
{
switch(i)
{
case 2:
if(n%2==0)
{
a[j]=2;
j++;

}
i++;
break;
case 3:
if(n%3==0)
{
a[j]=3;
j++;
}
i++;
break;
case 4:
if(n%4==0)

{
a[j]=4;
j++;
}
i++;
break;
case 5:
if(n%5==0)

{
a[j]=5;
j++;
}
i++;
break;
case 6:
if(n%6==0)

{
a[j]=6;
j++;
}
i++;
break;
case 7:
if(n%7==0)

{
a[j]=7;
j++;
}
i++;
break;
case 8:
if(n%8==0)

{
a[j]=8;
j++;
}
i++;
break;
case 9:
if(n%9==0)

{
a[j]=9;
j++;
}
i++;
break;
case 10:
if(n%10==0)

{
a[j]=10;
j++;
}
i++;
break;

}
}

if(j==0)
{
cout<<n<<" is not divisable by 2 to 10";
}
else
{
for(i=0;i<j;i++)
{
cout<<n <<" is divisable by "<<a[i]<<" ";
}
}
return 0;

}