Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <conio.h>
- #include <math.h>
- #include <iomanip>
- using namespace std;
- int main()
- {
- double x,y;
- int n;
- cout<<"X = ";
- cin>>x;
- cout<<"Y = ";
- cin>>y;
- cout<<"N = ";
- cin>>n;
- int limit = ceil((y-x) / n);
- int d= (limit* n) +x-1;
- long a = 1;
- int b = 1;
- int c = 0;
- for(int i=1;i<=d;i++){
- a=a*n%10;
- if (i>=x){
- if (b==limit){
- b=0;
- if(a==0&&c==0){
- cout<<setw(3)<<endl;
- c++;
- }
- else if(a==0&&c!=0){
- cout<<setw(3)<<endl;
- c==2?c=0:c++;
- }
- else if (i <= y){
- cout<<setw(3)<<a<<endl;
- } else {
- c==0?cout<<setw(3)<<"x":cout<<setw(3)<<"x";
- c==2?c=0:c++;
- }
- } else {
- if (a==0&&c==0){
- cout<<setw(3)<<" ";
- c++;
- }
- else if (a==0&&c!=0){
- cout<<setw(3)<<" ";
- c==2?c=0:c++;
- }
- else if (a==0&&c!=0){
- cout<<setw(3)<<" ";
- c==2?c=0:c++;
- }
- else if (i<=y){
- cout<<setw(3)<<a;
- } else {
- c==0?cout<<setw(3)<<"x":cout<<setw(3)<<"x";
- c==2?c=0:c++;
- }
- }
- b++;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement