CCCPaste

Menu_Creation_Usman

/*
Basic Idea
while(1)
{
	operarion1 : Palindrome
    operation2 : Sorting
    Operation3 : Analyze String
    Operation4 : Exit
   
}
*/

# include 
# include 

int palindrome_Usman(int n)
{
	int rev=0, rem, x, i;
    x = n;
    while(x!=0)
    {
    	rem = x % 10;
        rev = rev * 10 + rem;
        x = x / 10;
    }
    if(rev == n)
    	return n;
    else
    	return -1;
}


void sort_Usman(int x[], int n)
{
	int i,j,temp;
    for(i=0; i x[j+1])
            {
              temp = x[j];
              x[j] = x[j+1];
              x[j+1] = temp;
            }
        }
    }
    
    //Display the sorted array
	for(i=0 ; i 1)
            {
                printf("%c %d\n",j,freq[j]);
            }
        }
        printf("\n");
    }

}


int main()
{
	int choice,lowest,highest,n,i,result;
    
    while(1)
    {
    	printf("-----------Menu Driven Interface-----------\n");
        printf("Select 1 to Find Palindrome Numbers in a Given Range\n");
        printf("Select 2 to Sort an Array of Random Numbers\n");
        printf("Select 3 to Analyze Strings for Character Properties\n");
        printf("Select 4 to Exit the Program\n");
        
        printf("Select your Choice (1 to 4): ");
        scanf("%d", &choice);
        
        switch(choice)
        {
        	case 1:
                 printf("Enter the lowest value of the range: ");
                 scanf("%d",&lowest);
                 printf("Enter the highest value of the range: ");
                 scanf("%d",&highest);
                 for(i=lowest; i<=highest; i++)
                 {
                 	result = palindrome_Usman(i);
                    if(result == i)
                    {
                    	printf("%d ",result);
                    }
                 }
                 printf("\n");
                 break;
             
            case 2:
                 printf("Enter the number of Elements: ");
                 scanf("%d",&n);
                 int arr[200];
                 for(i=0;i