rect01_vishp21_HW3

rect01_vishp21_HW3 - '18%Second student age...

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

View Full Document Right Arrow Icon
Vishal Patel Rect 01 NetID-vishp21 Table of Contents datestr(now) . .............................................................................................................. 1 Problem 4 . ................................................................................................................. 1 Problem 3 . ................................................................................................................. 1 datestr(now) datestr(now) %This is a date string array and returns the current date and time in ans = 29-Oct-2010 15:07:40 Problem 4 student(1).name= 'Jack' ; %Name of the first student as a variable. student(1).age= '18' ; %Age of first student as a variable student(1).major= 'Computer Science' ; %Major of first student as a variable. student(2).name= 'Jill' ; %Second student name. student(2).age=
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: '18' ; %Second student age. student(2).major= 'Electrical and Computer Engineering' ; %Second student major. for x=1:2 fprintf( '%s is %s years of age and is studying %s.\n' ,student(x).name,student( x 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 x=10000000; %This is the smallest 8 digit prime number, the starting point. while (~isprime(x)) %Loop till you find the smallest 8 digit prime number. x=x+1; %Increases x by one until you find the smallest 8 digit prime number. end fprintf( 'The smallest 8 digit prime number is %.0f. \n' ,x) %Displays the smallest 8 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