lundi 4 mars 2013


Exercice En C++ corrigé gratuitement :

Ecrire un programme qui convertit un nombre du Octal vers le décimal .






Solution : 


#include<iostream.h>
main()
{i
nt n,i,b,m;
cout<<"enter number of bits"<<"\n";
cin>>n;
cout<<"note:enter octal number from right bite after bite"<<"\n";
Step By step to Learn C or C++ Example 12
int f=1,sum=0;
for(i=0;i<n;i++ ){
cin>>b;
m=f*b;
f=f*8;
sum=sum+m;}
cout<<sum;}

----------------------------
apprendre C++ facilement et gratuitement


0 commentaires:

Enregistrer un commentaire

Copyright © 2013 Exercices Langages de Programmation | Powered by Blogger
Design by Theme Junkie
Blogger Template by Lasantha | PremiumBloggerTemplates.com