#include<stdio.h>#include<iostream>
using namespace std;intmain(){float a=2*1.0/3;//若將1.0乘在分母,則需加括號
cout<<a<<endl;return0;}
判斷素數
#include<stdio.h>#include<iostream>
using namespace std;intmain(){int num;
cin>>num;int i;for(i=2;i<=num-1;i++){if(num%i==0){printf("%d is not prime number",num);return0;}break;};
cout<<"是"<<endl;return0;}