Please change this program/code using printf and show its flowchart
#include using namespace std;int isPrime(int n){ if (n <=>=> return 0; // Check from 2 to n-1 for (int i = 2; i < n;=""> if (n % i == 0) return 0; return 1;}int main(){ int ch,newCh,a,b,n; while(1) { cout<><"1.check prime="">"1.check><> cout<"2.factorial of="" a="">"2.factorial><> cout<"3.factors of="" a="">"3.factors><> cout<><> cout<"5.reverse of="" a="">"5.reverse><> cout<><> cout<"enter your="" choice:="">"enter> cin>>ch; switch(ch) { case 1: { cout<"enter a="" number="" to="" check="" whether="" it="" is="" prime="" or="" not:="">"enter> cin>>n; if(isPrime(n)) { cout<><><" is="">"><> } else cout<><" is="" not="">"><> } break; case 2: { cout<"enter a="" number:="">"enter> cin>>n; int fact=1; for(int i=1;i<> { fact=fact*i; } cout<><"factorial of="">"factorial><><" is:="">"><><> } break; case 3: { cout<"enter a="" number:="">"enter> cin>>n; cout<><"factors are:="">"factors> for(int i=1;i<> { if(n%i==0) cout } } break; case 4: { cout<><> cout<><> cout<><> cout<><> cout<"enter your="" choice:="">"enter> cin>>newCh; switch(newCh) { case 1: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 2: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 3: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 4: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<>< ="" ="" ="" ="" ="" cin="">>n; int rev=0; while(n>0) { int r=n%10; rev=rev*10+r; n=n/10; } cout<><"reverse of="" number="" is:="">"reverse><><> } break; case 6: { exit(0); } } } return 0;} >
using namespace std;int isPrime(int n){ if (n <=>=> return 0; // Check from 2 to n-1 for (int i = 2; i < n;=""> if (n % i == 0) return 0; return 1;}int main(){ int ch,newCh,a,b,n; while(1) { cout<><"1.check prime="">"1.check><> cout<"2.factorial of="" a="">"2.factorial><> cout<"3.factors of="" a="">"3.factors><> cout<><> cout<"5.reverse of="" a="">"5.reverse><> cout<><> cout<"enter your="" choice:="">"enter> cin>>ch; switch(ch) { case 1: { cout<"enter a="" number="" to="" check="" whether="" it="" is="" prime="" or="" not:="">"enter> cin>>n; if(isPrime(n)) { cout<><><" is="">"><> } else cout<><" is="" not="">"><> } break; case 2: { cout<"enter a="" number:="">"enter> cin>>n; int fact=1; for(int i=1;i<> { fact=fact*i; } cout<><"factorial of="">"factorial><><" is:="">"><><> } break; case 3: { cout<"enter a="" number:="">"enter> cin>>n; cout<><"factors are:="">"factors> for(int i=1;i<> { if(n%i==0) cout } } break; case 4: { cout<><> cout<><> cout<><> cout<><> cout<"enter your="" choice:="">"enter> cin>>newCh; switch(newCh) { case 1: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 2: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 3: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<> } break; case 4: { cout<"enter two="" numbers:="">"enter> cin>>a>>b; cout<>< ="" ="" ="" ="" ="" cin="">>n; int rev=0; while(n>0) { int r=n%10; rev=rev*10+r; n=n/10; } cout<><"reverse of="" number="" is:="">"reverse><><> } break; case 6: { exit(0); } } }
return 0;}
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here