rect01_vishp21_HW3 - '18%Second student age...

Info icon This 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=
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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern