Write C Programs Produce Output Described Following 1 Largest Factor Number User Supplies Q37121620

Write C++ programs to produce the output described in each ofthe following:

1- The largest factor of a number (the user supplies thenumber):

number = 24 , largest factor =12

2- An empty diamonds of stars ( the user supplies theheight)

*

* *

* *

* *

* *

* *

*

3- A pattern of 0’s surrounded by *’s ( the user supplies heightand width)

*************

*0*0*0*0*0*

*************

*0*0*0*0*0*

*************


Solution


#include <iostream>using namespace std;int main(){ int n; cout<<“Enter number: “; cin>>n; for(int i = n-1;i>=1;i–){ if(n%i == 0){

OR
OR

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.