Skip to content

Commit 830f9b8

Browse files
committed
spoj
1 parent 6921ce2 commit 830f9b8

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed

SPOJ/Basics/character_patterns2.cpp

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
int main()
5+
{
6+
int t;
7+
cin>>t;
8+
while(t--){
9+
int row,col;
10+
cin>>row>>col;
11+
for(int r=1;r<=row;r++){
12+
for(int c=1;c<=col;c++)
13+
{
14+
if(r==1 || r==row){
15+
cout<<"*";
16+
}
17+
else if(c==1||c==col){
18+
cout<<"*";
19+
}
20+
else{
21+
cout<<".";
22+
23+
}
24+
}
25+
cout<<endl;
26+
}
27+
cout<<endl;
28+
29+
}
30+
return 0;
31+
}

SPOJ/Classical/Factorial.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#include <iostream>
2+
#include <string>
3+
using namespace std;
4+
int main()
5+
{
6+
int t;
7+
cin>>t;
8+
while(t--){
9+
long long int n,ans=0;
10+
cin>>n;
11+
while(n>0){
12+
n=(n/5);
13+
ans=ans+n;
14+
}
15+
cout<<ans<<endl;
16+
}
17+
return 0;
18+
}

0 commit comments

Comments
 (0)