Advertisement
toan9xpro2012

cap so nhan

Feb 10th, 2017
501
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. program cau2;
  2. uses crt;
  3. var n,i,j,w:integer;
  4. t,congboi:real;
  5. a:array[1..100] of real;
  6.  
  7. begin
  8. clrscr;
  9. write('Nhap n= ');readln(n);
  10. for i:=1 to n do
  11. begin
  12. write('a[',i,']= ');
  13. readln(a[i]);
  14. end;
  15. congboi:=a[2]/a[1];
  16. w:=0;
  17. for i:=3 to n do
  18. begin
  19. t:=1;
  20. for j:=1 to (i-1) do t:=t*congboi;
  21. t:=t*a[1];
  22. if a[i] <> t then inc(w);
  23. end;
  24.  
  25. if (w<>0) and (congboi<>0) then
  26. write('Day da nhap khong phai cap so nhan')
  27. else
  28. write('Day da nhap la cap so nhan');
  29. readln;
  30. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement