Thread: Need Help.

  1. #1
    Registered User
    Join Date
    Sep 2014
    Posts
    8

    Need Help.

    I wrote the following Program.

    Code:
    #include<stdio.h>
    #include<conio.h>
    #include<stdlib.h>
    #include<dos.h>
    
    
    void even_odd();
    void prime_number();
    void leap_year();
    
    
    void main()
    {
    	clrscr();
    	int choice;
    
    
    	while(1)
    	{
    		gotoxy(5,1);	printf("-------------------");
    		gotoxy(5,2);	printf("Menu Driven Program");
    		gotoxy(5,3);	printf("-------------------");
    		gotoxy(5,5);	printf("1.Even or Odd");
    		gotoxy(5,6);	printf("2.Prime or Not");
    		gotoxy(5,7);	printf("3.Leap year or Not");
    		gotoxy(5,8);	printf("4.Exit");
    
    
    		printf("\n\n\tEnter Your Choice :");
    		scanf("%d",&choice);
    
    
    		switch( choice )
    		{
    			case 1 :
    						even_odd();
    						delay(200);
    						clrscr();
    						break;
    
    
    			case 2 :
    						prime_number();
    						delay(200);
    						clrscr();
    						break;
    			case 3 :
    						leap_year();
    						delay(200);
    						clrscr();
    						break;
    			case 4 :
    						exit(1);
    		}
    	}
    }
    void even_odd()
    {
    	int number;
    
    
    	printf("\n\tEnter number :");
    	scanf("%d",&number);
    
    
    	if( number %2 == 0)
    		printf("\n\t%d is an even number.",number);
    	else
    		printf("\n\t%d is an odd number.",number);
    
    
    	getch();
    }
    void prime_number()
    {
    	int i,num;
    	printf("\n\tEnter the number :");
    	scanf("%d",&num);
    
    
    	for(i=2;i<=(num-1);)
    	{
    		if(!(num%i==0))
    			i++;
    		else
    		{
    			printf("\n\tNot a Prime Number");
    			break;
    		}
    	}
    	if(i==num)
    		printf("\n\tIt is a prime number");
    	getch();
    }
    void leap_year()
    {
    	int year;
    
    
    	printf("\n\tEnter a year to check if it is a leap year :");
    	scanf("%d", &year);
    
    
    	if ( year%100 == 0)
    	{
    		if ( year%400 == 0)
    			printf("\n\t%d is a leap year.\n", year);
    		else
    			printf("%\n\td is not a leap year.\n", year);
    	}
    	else
    	{
    		if ( year%4 == 0 )
    			printf("\n\t%d is a leap year.", year);
    		else
    			printf("\n\t%d is not a leap year.", year);
    	}
    	getch();
    
    
    }

    I want some questions to be answer for practical purpose.Pls tell me.


    1.Objective-need
    2.Problem definition
    3.Research Methodology-How to ran program
    4.Limitation-4 points.


    pls tell me.Tnku.

  2. #2
    Registered User
    Join Date
    Jun 2005
    Posts
    6,815
    For what purpose did you write the program? That is the objective need.

    What problem did you write the program to solve? That is the problem definition.

    Before writing the program, what techniques did you investigate for solving that problem? How did you do the investigation? That is the research methodology.

    What boundary conditions or constraints did you accept in order to write your program? Each condition or constraint is a limitation.



    The thing is, however, you've done it all backward. It is conventionally expected that the need will be articulated, the problem(s) will be defined, the alternatives investigated, and the limitations accepted before ANY code is written. Not AFTER.
    Right 98% of the time, and don't care about the other 3%.

    If I seem grumpy or unhelpful in reply to you, or tell you you need to demonstrate more effort before you can expect help, it is likely you deserve it. Suck it up, Buttercup, and read this, this, and this before posting again.

  3. #3

Popular pages Recent additions subscribe to a feed

Tags for this Thread