rect03_akshay24_HW03

# rect03_akshay24_HW03 - second element with three fields...

This preview shows page 1. Sign up to view the full content.

Akshay Patel Rect-03 netid-akshay24 Table of Contents datestr(now) . .............................................................................................................. 1 Problem 4 . ................................................................................................................. 1 Problem 3 . ................................................................................................................. 1 datestr(now) datestr(now) % This is a date string array and it returns the current date and time ans = 29-Oct-2010 15:10:14 Problem 4 student(1).name= 'Jack' ; % structure student element 1, containing three fields, nam e student(1).age= '18' ; student(1).major= 'Computer Science' ; student(2).name= 'Jill'
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ; % second element with three fields name, age, major student(2).age= '18' ; student(2).major= 'Electrical and Computer Engineering' ; for x=1:2 % use of for-loop to show each student's information fprintf( '%s is %s years of age and is studying %s\n' ,s(x).name,s(x).age,s(x). m end Jack is 18 years of age and is studying Computer Science Jill is 18 years of age and is studying Electrical and Computer Engineering Problem 3 Y=10000000; % it is the smallest possible while (~isprime(Y)) % keeps looping till you find the prime Y=Y+1; end fprintf( 'The smallest 8 digit prime number is %.0f.\n' ,Y) The smallest 8 digit prime number is 10000019. Published with MATLAB® 7.10 1...
View Full Document

## This note was uploaded on 03/24/2011 for the course PHYSICS 123 taught by Professor Madey during the Spring '08 term at Rutgers.

Ask a homework question - tutors are online