1 solutions
-
0
C :
#include<stdio.h> int main(){ int i=1; while(i<=25){ if((i==10)||(i==15)||(i==20)||(i==25)) printf("%d\n",i); else if(i==5) printf(" %d\n",i); else if(i<=10) printf(" %d ",i); else if(i<=25) printf("%d ",i); i=i+1; } return 0; }C++ :
#include<iostream> using namespace std; int main(){ for(int i=1;i<=10;i++){ if(i == 1 || i ==6) cout<<" "<<i; else if( i<10) cout<<" "<<i; else cout<<" "<<i; if(i%5 == 0) cout<<endl; } for(int j=11;j<=25;j++){ if(j%5 == 0) cout<<j<<endl; else cout<<j<<" "; } return 0; }Pascal :
begin writeln(' 1 2 3 4 5'); writeln(' 6 7 8 9 10'); writeln('11 12 13 14 15'); writeln('16 17 18 19 20'); writeln('21 22 23 24 25'); end.Java :
public class Main { public static void main(String[] args) { for(int i = 1;i<=25;i++) { System.out.printf("%2d",i); if(i%5!=0) System.out.print(" "); else System.out.print("\n"); } } }
- 1
Information
- ID
- 19491
- Time
- 1000ms
- Memory
- 128MiB
- Difficulty
- (None)
- Tags
- # Submissions
- 0
- Accepted
- 0
- Uploaded By