Lab 9.docx - Lab#09 2014-EE-231 Object To design a program having up to 3 hierarchies Source Code*To make a program that determines Even or Odd using

Lab 9.docx - Lab#09 2014-EE-231 Object To design a program...

This preview shows page 1 - 6 out of 10 pages.

Lab#09 2014-EE-231 Object: To design a program having up to 3 hierarchies. Source Code: /*To make a program that determines Even or Odd using Global Variable*/ #include<stdio.h> #include<conio.h> void evenodd(void); /*Function Prototype */ int keynub; //Global Variable// void main(void) { clrscr(); name(); printf("Type Keynumb:"); scanf("%d",&keynub); evenodd(); /*Function Caller */ getch(); } void evenodd(void) { if(keynub%2!=0) printf("Odd\n"); else Computer Fundamentals & Programming 1
Image of page 1

Subscribe to view the full document.

Lab#09 2014-EE-231 printf("Even\n"); } Output: Computer Fundamentals & Programming 2
Image of page 2
Lab#09 2014-EE-231 Object: To sum 2 floats and 2 integers directly using type casting. Source Code: #include<stdio.h> #include<conio.h> int sum(float,float,int,int); void main(void) { clrscr(); name(); int a,b; float c,d; printf("Enter two integer:"); scanf("%d%d",&a,&b); printf("Enter two float:"); scanf("%f%f",&c,&d); printf("Sum is %d",sum(c,d,a,b)); getch(); } int sum(float x,float y,int z,int s) { int sum1,sum2; Computer Fundamentals & Programming 3
Image of page 3

Subscribe to view the full document.

Lab#09 2014-EE-231 sum1=(int)(x+y); sum2=z+s; return(sum1+sum2); } Output: Computer Fundamentals & Programming 4
Image of page 4
Lab#09 2014-EE-231 Object: To generate a program that calculates area of Sphere using Macro.
Image of page 5

Subscribe to view the full document.

Image of page 6
  • Spring '15
  • R. Boylested

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

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes