第二题#include "iostream.h"
int main(int argc, char* argv[]){ int i,j; for(i=1;i<10;i++){ cout<<"\n"; for(j=1;j<=i;j++) cout<<j<<"*"<<i<<"="<<i*j<<" "; } return 0;}
#include<iostream.h>#include<math.h>void main(){cout<<"input the number:";int n;cin>>n;int j,leap=1,i;for(i=1;i<=n;i++){ for(j=2;j<=sqrt(i);j++)//起始值要从2开始{ if(i%j==0) { leap=0; break; }} if(leap) { cout<<i<<endl; } leap=1;}}