게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
c언어좀 도와주시겠어요?
게시물ID : computer_87085짧은주소 복사하기
작성자 : 버블드래곤
추천 : 0
조회수 : 385회
댓글수 : 13개
등록시간 : 2013/05/07 08:34:17

#include <stdio.h>
#include <time.h>
#include <stdlib.h>
int main(void)
{
clock_t inittime = clock();

int a, b, c;
int count= 0;
double seconds;
clock_t start, finish;
{
srand((unsigned)time(NULL));
start=clock();
for(a=1 ; a<=1500 ; a++)
{
for(b=1 ; b<=1500 ; b++)
{
for(c=1 ; c<=1500 ; c++)
{
if((a*a+b*b)==c*c)
 if(a>b)
printf("%d %d %d\n", a, b, c);
if((a*a+b*b)==c*c)
 if(a>b)
{count=count+1;
printf("총 갯수 : %d\n", count);
}}}}}
finish=clock();
seconds=(double)(finish-start)/CLOCKS_PER_SEC;
printf("TIME(seconds): %if", seconds);
return 0;
}

여기서 다 되는데 시간이 잘못 나오네요.

아무래도 빌드할 때 시간변수를 초기화 시켜서 해야할 것 같은데

책에는 나오지를 않네요 망할책ㅠㅠ

그래서 그런데 어떻게 하면 시간이 제데로 나올수 있을까요?

(제발 시간말고 딴거로 태클걸지마요 이거만드느라고 힘들었어요ㅠㅠ

어차피 빌드는 되니까 제발ㅠㅠ)

전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호