{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# BIL104E_w5 - BIL104E INTRODUCTION TO SCIENTIFIC AND...

This preview shows pages 1–7. Sign up to view the full content.

BIL104E INTRODUCTION TO SCIENTIFIC AND ENGINEERING COMPUTING (C) WEEK – 5

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
FUNCTIONS #include <stdio.h> Function_prototype Main function { Function_call } Function definition
Function Prototype double fonksiyon1(double x, int y); int fonksiyon2(double x, int y); void fonksiyon3(double x, double y);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Function Definition int fonksiyonum(int x, double y) { x = 1+2; y = 1.0 + 2.0; }
Random Number Generator rand function Load <stdlib.h> Returns "random" number between 0 and RAND_MAX (at least 32767 ) number = rand(); Scaling To get a random number between 1 and n ( rand() % n ) rand() % n returns a number between 0 and n 1 ( rand() % 6 ) between 0 - 5 Add 1 to make random number between 1 and n 1 + ( rand() % n) ( rand() % 6)+1 between 1 6 Randomizing to get different value with rand function use load <time.h> srand (time(NULL));

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Application-I Write a rolling dice program Choose number of dice face (standart 6)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 11

BIL104E_w5 - BIL104E INTRODUCTION TO SCIENTIFIC AND...

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online