Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Se da un nr n. Sa se elimine toate cifrele cuprinse intre c1 si c2(c1<c2).
- #include <iostream.h>
- #include <fstream.h>
- int c1, c2, x;
- long n;
- void citire()
- {
- ifstream f("cit.in");
- f>>n;
- f>>c1>>c2;
- }
- void numar(long n, int c1, int c2, int x)
- {
- int og=0, c=0;
- while(n)
- {
- c=n%10;
- if(c >= c1 && c <= c2)
- {
- }
- else
- {
- x=x*10+c;
- }
- n/=10;
- }
- while(x)
- {
- og=og*10+x%10;
- x/=10;
- }
- cout<<og;
- }
- int main()
- {
- citire();
- numar(n, c1, c2, x);
- }
- /* cit.in */
- 162448
- 4 7
- /*
- Ex: n=162448, c1=4, c2=7;
- Valoarea furnizata este 128
- */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement