Rezolvari

Description

Mind Map on Rezolvari, created by AIDA-MARIA TURBUREANU on 08/05/2020.
AIDA-MARIA TURBUREANU
Mind Map by AIDA-MARIA TURBUREANU, updated more than 1 year ago
AIDA-MARIA TURBUREANU
Created by AIDA-MARIA TURBUREANU over 4 years ago
2
0

Resource summary

Rezolvari
  1. Exemplu În urma apelului FRadical(15000, x, y), se obține x = 50, y = 6. #include <iostream> #include <cmath> using namespace std; void FRadical(long n,long &x,long &y) { int ind=0; for(y=1;y<=n && ind==0;y++) { if(n%y==0) { x=sqrt(n/y); if(x*x==n/y) ind=1; } } y--; } int main() { long n; cin>>n; long x,y; FRadical(n,x,y); cout<<x<<' '<<y; return 0; }
    1. 2. #include <iostream> using namespace std; void sum_cif(long n,int &s) { if(n>=10) { sum_cif(n/10,s); s=s+n%10; } else s=n; } int main() { long n; int s; cin>>n; sum_cif(n,s); cout<<s; return 0; }
      1. 3. Dacă n are valoarea 85412, după apelul dublare1(n), n va fi 885412. #include <iostream> using namespace std; void dublare1(long &n) { long p=1; while(n/p>9) { p=p*10; } n=(n/p)*p*10+n; } int main() { long n; cin>>n; dublare1(n); cout<<n; return 0; }
        1. 4. Dacă n = 1372, după apelul funcției perm, valoarea lui n va fi 3721. #include <iostream> void perm(long &n) { long p=1; while(n/p>9) { p=p*10; } n=n%p*10+n/p; } using namespace std; int main() { long n; cin>>n; perm(n); cout<<n; return 0; }
          Show full summary Hide full summary

          Similar

          Sociology
          shattering.illus
          Musical Symbols
          kcollins3
          AS Economics Key Terms
          Fred Clayton
          Chemistry GCSE
          frimpongr
          Python Quiz
          karljmurphy
          Jane Eyre
          sennahlee
          AP Psychology Practice Exam
          Jacob Simmons
          Paradise Lost Themes/Quotes
          Kirsty S
          Biology: Reproduction Flash Cards.
          LV1662000
          Crude Oils and others quiz
          Dale George
          Philosophy - p1
          Temirlan Shablin