User
Pass
2FA
 
 

C++

 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Homework zone
Author Message1535
SharinganLeX

[Account disabled]



Status: Offline
(since 23-01-2014 15:47)
Joined: 18 Nov 2011
Posts: 432, Topics: 79
Location: Bucuresti

Reputation: 25.9
Votes: 8

Post Posted: 28-02-2013, 20:31:51 | Translate post to: ... (Click for more languages)

Cine ma poate ajuta cu o problema de informatica? (clasa a 10a)
Se citesc de la tastatura un nr. nat "n" (maxim 9 cifre) scrieti program c++ care afiseaza nr. format din aceleasi cifre ale lui n modificate astfel, cifrele pare cresc cu o unitate, iar cele impare scad cu o unitate.

Asa am incercat eu dar nu cred ca e bine:

#include <iostream.h>
void main()
{unsigned long n,m;
cout<<"n="; cin>>n; cin>>m;
n=m
while(m%2=0) m++
while(m%3=0) m--


Multumesc anticipat.

0 0
  
Back to top
View user's profile Send private message
coldicee

[trudalizatorul]



Status: Offline
(since 05-11-2018 13:26)
Joined: 28 Oct 2011
Posts: 784, Topics: 62
Location: Behind You

Reputation: 26.7
Votes: 22

 
Post Posted: 28-02-2013, 20:55:37 | Translate post to: ... (Click for more languages)

ai gresit sectiunea, posteaza la scoli




0 0
  
Back to top
View user's profile Send private message
Burebysta

[Retired Veteran]



Status: Offline
(since 27-08-2022 20:01)
Joined: 27 Jun 2011
Posts: 17044, Topics: 509
Location: Cluj-Napoca

Reputation: 3626.7
Votes: 245

Post Posted: 28-02-2013, 21:11:39 | Translate post to: ... (Click for more languages)

Ai mai multe sanse daca postezi la "La cafenea" sau "La scoala"

http://forum.wow-freakz.com/Nu-uitati-forumul-e-mai-mare-decat-sectiunea-asta-de-WoW-t29114.html





0 0
  
Back to top
View user's profile Send private message
Alexander0810

[VIGILO CONFIDO]



Status: Offline
(since 08-03-2024 13:58)
Joined: 13 Mar 2010
Posts: 12665, Topics: 267
Location: Romania

Reputation: 2269
Votes: 151

 
Post Posted: 28-02-2013, 21:21:11 | Translate post to: ... (Click for more languages)

Code:
#include <iostream.h>
void main()
{int n,m,k;
m=0;
cout<<"n=";
cin>>n;
while(n!=0)
   {
     k=n%10;
     if(k%2=0)
         k=k++;
       else
         k=k--;
     m=m+k;
     m=m*10;
     n=n/10;
   }
n=0;
while(m!=0)
   {
     n=m%10;
     n=n*10;
     m=m/10;
    }
cout<<"Numarul nou este"<<n;
}




L-am facut in ~1 min, s-ar putea sa fie greseli in logica algoritmului. Data viitoare postezi "la scoli".

0 0
  
Back to top
View user's profile Send private message

  Topic locked


Topic is closed, you cannot post any messages in it anymore

Locked by Alexander0810, 28 February 2013 19:22



 
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Freakz Forum Index -> Trash Bin -> Trash -> Homework zone  


The time now is 28-04-2024, 16:57:23
Copyright info

Based on phpBB ro/com
B

 
 
 







I forgot my password


This message appears only once, so
like us now until it's too late ! :D
x