- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 4
- Posts with Downvotes
- 2
- Downvoting Members
- 3
3 Posted Topics
Mine is a bit too much using just simple for and if loops #include<iostream> #include<stdlib.h> using namespace std; int main() { int a[16]={0},b,i=0; cout<<"\n Enter the number to be converted to binary"; cin>>b; if(b==0) { cout<<"\n 0000"; exit(1); } while(b!=0){ a[i]=b%2; b/=2; i++; if(b==1) { a[i]=1; break; } } for(int …
#include<iostream> using namespace std; int main() { int i=1,a,j=1; cout<<"\n Enter the number until which looping is to be done"; cin>>a; for(i=1;i<=a;i++) { cout<<"\n"; j=1; do { cout<<j; j++; }while(j<=i); if(i==a) { for(int k=a-1;k>0;k--) { cout<<"\n"; j=1; do { cout<<j; j++; }while(j<=k); } } } for(int p=a;p>0;p--) { cout<<"\n"; j=1; …
Ok, this maybe the only time you are getting help for your homework.. #include<iostream> using namespace std; int main() { int a,b; cout<<"\n Enter the numbers, only between 3000000 and 5000000..."; cin>>a>>b; if(3000000>=a<=5000000 && 3000000>=b<=a) cout<<"\n The sum is.."<<a+b; cin.get(); }
The End.
Sam_6