C Lab Programs- I B.Com(CA)



PROGRAMMING IN C LAB


1.  Find out the given number is perfect number or not  using c program.
2.  Write a C program to check whether the given number is Armstrong or not.
3.  Write a C program to find the sum of individual digits of a positive integer.
4.  A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to print the Fibonacci series
5.  Write a C program to generate the first n terms of the Fibonacci sequence.
6.  Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.
7.  Write a C program to find both the largest and smallest number in a list of integers.
8.  Write a C program that uses functions to perform the following:
a.   Addition of Two Matrices
b.   Multiplication of Two Matrices
9. Write C program that implements searching of given item in a given list
10. Write a C program to sort a given list of integers in ascending order
 



Q. Write a C program to check whether a given number is a perfect number or not.

Definition of Perfect number: A positive integer n is called a perfect number if it is equal to the sum of all of its positive divisors, excluding n itself.

For example, 6 is perfect integer number, because 1, 2 and 3 are its proper positive divisors and 1+2+3=6.
The next perfect number is 28 because 1+2+4+7+14=28.
The next perfect number is 496 because
1+2+4+8+16+31+62+124+248=496.

ALGORITHM TO CHECK PERFECT NUMBER

(Perfect Number) Let N be positive Integer. This algorithm will check whether N is perfect number or not. To do so we have to find the factors of N. And then we have to add all factors except N. Now we have to compare N with sum of factors (Denoted By SOF in Algorithm). If N is equal to SOF then N is a perfect number. And if N is not equal to SOF then N is not a perfect number.
Step 1: Start
Step 2: [ Take Input ] Read: N
Step 3: [ Initialize ] Set: SOF = 0 and I = 1
Step 4: Repeat While I < N
                        Check If N%I == 0 Then
                                    Compute: SOF = SOF + I
                        [ End of If Structure ]
                        Compute: I = I + 1
            [ End of While Loop ]
Step 5: Check If N == SOF Then
                        Print: N is a Perfect Number.
            Else
                        Print: N is not a Perfect number.
Step 6: Exit

FLOWCHART TO CHECK PERFECT NUMBER




Program:
/*program to check whether a number is perfect or not*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int i,n,num,sum=0;
 printf("Enter a number : ");
 scanf("%d",&num);
 n=num;
 for(i=1; i<n; i++)
 {
  if(num%i==0)
     sum=sum+i;
 }
 if(num==sum)
  printf("Given number is Perfect Number ");
 else
  printf("Given number is Not Perfect Number ");
 getch();
 return 0;
}

Output:-

Enter a number : 7543
Given number is Not Perfect Number

Enter a number : 8128
Given number is Perfect Number

Q2. Write a program to check whether a number is a Armstrong number or not.
Definition of Armstrong number: An Armstrong number of three digits is an integer such that the sum of the cubes of its digits is equal to the number itself.
In other word “A number is Armstrong if it is equal the sum of cube of its digits.”
Example of Armstrong number is 371 because according to definition cube of its digits  sum will be equal to number so
Armstrong number 371=(3)3+(7)3+(1)3
                 371=27+343+1
                 371=371

ALGORITHM TO CHECK ARMSTRONG NUMBER

Let N be a three digit Integer. This algorithm checks that whether N is an Armstrong Number or not.
Step 1: Start
Step 2: Take Input N as Integer
Step 3: [ initializing SUM ] Set: SUM = 0
Step 4: Set: Number = N
Step 5: Repeat While Number ≠ 0
SUM = (Number%10)**3 + SUM
Number = Number/10
[ End of While Loop ]
Step 6: [ Checking ? ]
If SUM == N then
Print: N is an Armstrong Number.
Else
Print: N is not an Armstrong Number.
[End of If-Else Structure]
Step 7: Exit

FLOWCHART TO CHECK ARMSTRONG NUMBER


Program:
/*program to check whether a number is Armstrong or not*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int n,num,rem,sum=0;
 printf("Enter any number : ");
 scanf("%d", &num);
 for(n=num; n>=1; n=n/10)
 {
   rem=n%10;
   sum=sum+(rem*rem*rem);
 }
 if(num==sum)
    printf("Number is Armstrong number");
 else
    printf("Number is not Armstrong number");
 getch();
 return 0;
}

Output:-

Enter any number :254
Entered number is not Armstrong number
                   
Enter any number : 371
Entered number is Armstrong number

 
Q3: Write a C Program to  find the sum if individual digits of a positive integer.

Description:
Sum of the individual digits means adding all the digits of a number.
Ex: 123 sum of digits is 1+2+3 = 6

Algorithm:

Step 1: Start
Step 2: Read num as integer
Step 3: while (num > 0)
          begin
            dig num MOD 10;
            sumOfDigits sumOf Digits + dig;
            num num DIV 10;
         end
Step 4: Print sumOfDigits
Step 5: Stop
Flowchart:

 

Program:
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main ()
{
 int number = 0, digit = 0, sumOfDigits = 0;
 clrscr();
 printf("Enter any number\n ");
 scanf("%d", &number);
 while (number != 0)
 {
  digit = number % 10;
  sumOfDigits = sumOfDigits + digit;
  number = number / 10;
 }
 printf ("Sum of individual digits of a given number is %d", sumOfDigits);
 getch();
}
Input & Output:
Enter any number
1234
Sum of individual digits of a given number is 10
Viva Questions:
Q: What is the mean of sum of the individual digits?
Ans: Sum of the individual digits means adding each digit in a number.
Q: What is positive integer?
Ans: if the integer value is grater than zero then it is called positive integer.
Q: Define preprocessor ?
Ans: Before compiling a process called preprocessing is done on the source code by a program called the preprocessor.

Q4: A Fibonacci sequence is defined as follows: the first and second terms in the sequence are 0 and 1. Subsequent terms are found by adding the preceding two terms in the sequence. Write a C program to generate the first n terms of the sequence.

Description:
A fibonacci series is defined as follows:
  • The first term in the sequence is 0
  • The second term in the sequence is 1
  • The sub sequent terms 1 found by adding the preceding two terms in the sequence
  • Formula: let t1, t2, ………… tn be terms in fibinacci sequence
  • t1 = 0, t2 = 1
  • tn = tn - 2 + tn - 1 …… where n > 2
Algorithm:
Step 1: Start
Step 2: Read a, b, sum, lengthOfSeries values as integers
Step 3: Set a as 0 and b as 1
Step 4: for counter: 2 to no increment counter by 1
          begin   
          sum a + b;
          Print sum
          a b;
          b sum;
          end
Step 5: Stop
Flowchart:
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
 int a = 0, b = 1, lengthOfSeries = 0, counter, sum = 0;
 clrscr();
 printf("Enter the length of series \n ");
 scanf("%d", &lengthOfSeries);
 printf("Fibonacci series\n");
 printf("%d  %d", a, b);
 for(counter = 2; counter < lengthOfSeries; counter++)
 {
  sum = a + b;
  printf("  %d",sum);
  a = b;
  b = sum;
 }
 getch();
}
Input & Output:
Enter the length of series
15
Fibonacci series
0 1 1 2 3 5 8 13 21 34 55 89 144 233 377
Viva Questions:
Q5: What is Fibonacci series ?
Ans: A fibonacci series is defined as follows:
·         The first term in the sequence is 0
·         The second term in the sequence is 1
·         The sub sequent terms 1 found by adding the preceding two terms in the sequence
·         Formula: let t1, t2, ………… tn be terms in fibinacci sequence
·         t1 = 0, t2 = 1
·         tn = tn - 2 + tn - 1 …… where n > 2

Q6: Write a C program to generate all the prime numbers between 1 and n, where n is a value supplied by the user.

Description:

 Prime number is a number which is exactly divisible by one and itself only   Ex: 2, 3, 5, 7,………

Algorithm:

Step 1: start
Step 2: read n
Step 3: initialize i = 1, c = 0
Step 4:if i <= n goto step 5
            If not goto step 10
Step 5: initialize j = 1
Step 6: if j <= 1 do as the follow. If no goto step 7
            i)if i%j == 0 increment c
            ii) increment j
            iii) goto Step 6
Step 7: if c == 2 print i
Step 8: increment i
Step 9: goto step 4
Step 10: stop 

Flowchart:

http://i.imgur.com/xi25ymf.png

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
   int n, i, j, count;
   clrscr();
   printf("Prime no.series\n");
   printf("Enter any number\n");
   scanf("%d", &n);
   printf("The prime numbers between 1 to %d\n",n);
   for(i = 1; i <= n; i++)
   {
      count = 0;
      for(j = 1; j <=i; j++)
      if(i % j == 0)
      {
     count++;
      }
      if(count == 2)
      {
     printf("%d\t", i);
      }
   }
   getch();
}

Input & Output:

Prime no. series 
Enter any number 
10
The prime numbers between 1 to 10
2  3  5  7

Viva Questions:

Q: What is prime number ?
Ans: Prime number is a number which is exactly divisible by one and itself only.
Q: What is an algorithm?
Ans: A step by step procedure is called algorithm.
Q: What is flow chart?
Ans: A pictorial representation an algorithm is called a flow chart.
Q: What is program?
Ans: A collection of statements is called.

Q7: Write a C program to find the largest integer and smallest number in a list of integers

Algorithm:

Step 1: Start
Step 2: Read n and a[i] as integers
Step 3: Declare maxpos as 1
Step 4: Assign max  A[1]
Step 5: for i: 1 to n increment i by 1
         begin
           if(max < A[i])
           begin
             max  A[i];
             maxpos  i;
               end
         end
Step 6: Assign min A[1];
          Declare minpos as 1;
Step 7: for i: 1 to n increment i by 1
         begin
           if(min>A[i])
           begin
             min  A[i];
             minpos  i;
           end
         end
Step 4: Print max, min
Step 5: Stop

Program:

#include <stdio.h>
#include <conio.h>
void main()
{
   int a[25], i, large, small, n;
   clrscr();
   printf("Enter the size of array(max 25)\n");
   scanf("%d", &n);
   printf("Enter any %d integer array elements\n",n);
   for(i = 0; i < n; i++)
   {
    scanf("%d", &a[i]);
   }
   large = a[0];
   small = a[0];
   for(i = 1; i < n ; i++)
   {
      if(a[i] > large)
      {
    large = a[i];
      }
      if(a[i] < small)
      {
    small = a[i];
      }
   }
   printf("The largest element from the given array is %d \nThe smallest element  from the given array is %d", large, small);
   getch();
}

Input & Output:

Enter the size of array(max 25)
5
Enter any 5 integers array elements  
10 2 3 1 5
The largest element from the given array is 10
The smallest element from the given array is 1

Q8: Write a C program that uses functions to perform the following:

        i.            Addition of Two Matrices

      ii.            Multiplication of Two Matrices

Algorithm:

Step 1: Start
Step 2: Declare i, j, k, A[3][3], B[3][2], C[3][2] as integers
Step 3: Initialize i = 0, j = 0
Step 4: Till i < 3 execute step 5 else goto step 9
Step 5: Till j < 3 execute steps 6 to 7 else goto step 8
Step 6: Read A[i][j]
Step 7: Increment j by 1 goto step 5
Step 8: Increment i by 1 goto step 4
Step 9: Initialize i = 0, j = 0
Step 10: Till i < 3 execute step 11 else goto step15
Step 11: Till j < 2 execute steps 6 to 7 else goto step 14
Step 12: Read B[i][j]
Step 13: Increment j by 1 goto step 11
Step 14: Increment i by 1 goto step 10
Step 15: Initialize i = 0, j = 0, k = 0
Step 16: Till i < 3 execute step 17 else goto step 24
Step 17: Till j < 2 execute step 18  else goto step 23
Step 18: Initialize C[i][j] = 0
Step 19: Till k<3 execute steps 20 to 21 else goto step
Step 20: calculate C[i][j] = C[i][j] + A[i][k] * B[k][j]
Step 21: Increment k by 1 goto step 19
Step 22: Increment j by 1 goto step 17
Step 23: Increment i by 1 goto step 16
Step 24: Initialize i = 0, j = 0
Step 25: Till i < 3 execute step 26 else goto step 30
Step 26: Till j < 3 execute steps 27 to 28 else goto step 29
Step 27: Print C[i][j]
Step 28: Increment j by1 goto step 26
Step 29: Increment i by 1 goto step 25
Step 30: Stop

Addition of Two Matrices

Program:

#include <stdio.h>
#include <conio.h>
void main()
{
   int a[3][3], b[3][3], c[3][3], i, j;
   clrscr();
   printf("Enter the elements of 3*3 matrix a \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     scanf("%d", &a[i][j]);
      }
   }
   printf("Enter the elements of 3*3 matrix b \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
    scanf("%d", &b[i][j]);
      }
   }
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     c[i][j] = a[i][j] + b[i][j];
      }
   }
   printf("The resultant 3*3 matrix c is \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     printf("%d\t", c[i][j]);
      }
      printf("\n");
   }
   getch();
}

Input & Output:

Enter the elements of 3*3 matrix  a
1 2 3 4 5 6 7 8 9
Enter the elements of 3*3 matrix  b
1 2 3 4 5 6 7 8 9
The resultant 3*3 matrix  c is
2      4      6
8     10     12
14    16     18


Multiplication of Two Matrices

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
   int a[3][3], b[3][3], c[3][3], i, j, k;
   clrscr();
   printf("Enter the elements of 3*3 matrix a \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     scanf("%d", &a[i][j]);
      }
   }
   printf("Enter the elements of 3*3 matrix b \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
    scanf("%d", &b[i][j]);
      }
   }
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     c[i][j] = 0
     for(k = 0; k < 3; k++)
     {
        c[i][j] = c[i][j] + (a[i][k] * b[k][j])
     }
      }
   }
   printf("The resultant 3*3 matrix c is \n");
   for(i = 0; i < 3; i++)
   {
      for(j = 0; j < 3; j++)
      {
     printf("%d\t", c[i][j]);
      }
      printf("\n");
   }
   getch();
}

Input & Output:

Enter the elements of 3*3 matrix  a
1 2 3 4 5 6 7 8 9
Enter the elements of 3*3 matrix  b
1 2 3 4 5 6 7 8 9
The resultant 3*3 matrix  c is
30    36      42
55    81      96
102   126     150



9. Write a C program that uses non recursive function to search for a Key value in a given list of integers using Linear search.

Algorithm:

Step 1: Start
Step 2: Read n, a[i], key values as integers
Step 3: Search the list
         While (a[i] != key && i <= n)
          i = i + 1
           Repeat step 3
Step 4: Successful search
         if(i = n + 1) then
          print “Element not found in the list”
          Return(0)
         else
          print “Element found in the list”
          Return (i)
Step 6: Stop

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
 int i, a[20], n, key, flag = 0;
 clrscr();
 printf(“Enter the size of an array \n”);
 scanf(“%d”, &n);
 printf(“Enter the array elements”);
 for(i = 0; i < n; i++)
 {
  scanf(“%d”, &a[i]);
 }
 printf(“Enter the key elements”);
 scanf(“%d”, &key);
 for(i = 0; i < n; i++)
 {
  if(a[i] == key)
  {
   flag = 1;
   break;
  }
 }
 if(flag == 1)
  printf(“The key elements is found at location %d”, i + 1);
 else
  printf(“The key element is not found in the array”);
 getch();
}

Input & Output:

Enter the size of an array 6
Enter the array elements 50 10 5 200 20 1
Enter the key element 1
The key Element is found at location 6


Q10. Write a C program that implements the Selection sort method to sort a given array of integers in ascending order.


Algorithm:

Step 1: Start
Step 2: Read n, a[i] values as integers
Step 3: for i: 1 to n do increment i by 1
        begin
         min = i;
         for j: i + 1 to n increment j by 1
         begin
          if(a[j] < a[min])
          min = j;
         end
         t = a[i];
         a[i] = a[min];
         a[min] = t;
        end
Step 4: for i: 0 to n
        print a[i]
Step 5: Stop

Program:

#include<stdio.h>
#include<conio.h>
void main()
{
 int n, a[20], min, temp, i, j;
 clrscr();
 printf("Enter the size of the array\n");
 scanf("%d", &n);
 printf("Enter the  array elements\n");
 for(i = 0; i < n; i++)
 {
  scanf("%d", &a[i]);
 }
 for(i = 0; i < n - 1; i++)
 {
  min = i;
  for(j = i + 1; j < n; j++)
  {
   if(a[j] < a[min])
   min = j;
  }
  temp = a[i];
  a[i] = a[min];
  a[min] = temp;
 }
 printf("The sorted array is\n");
 for(i = 0; i < n; i++)
  printf("%d\n", a[i]);
 getch();
}

Input & Output:

Enter the size of the array: 7
Enter the array elements: 7  6  5  4  3  2  1  
The Sorted array is: 1  2  3  4  5  6  7



#include <stdio.h>
#include<conio.h>
#include<string.h>
#include<ctype.h>
#include<stdlib.h>

int length(char str[]);
void reverse(char str[]);
int palindrome(char str[]);
void copy(char str1[], char str2[]);
int compare(char str1[], char str2[]);
void concat(char str1[], char str2[]);
void search(char str1[], char str2[]);
void count(char str1[]);

void main() {
   char a[100], b[100];
   int result, option;
   do {
      printf("\n1.Length of a string");
      printf("\n2.Reverse the Given String");
      printf("\n3.Check for Palindrome");
      printf("\n4.Copy");
      printf("\n5.String Comparison");
      printf("\n6.String Concatenation");
      printf("\n7.String Searching");
      printf("\n8.Counting of Words,Characters & Special Characters");
      printf("\n9.Quit");
      printf("\n\nEnter Your Choice:");
      scanf("%d", &option);

      flushall();
      switch (option) {
      case 1:
         printf("\nEnter a String:");
         gets(a);
         result = length(a);
         printf("\nLength of %s=%d", a, result);
         printf("\nPress a Character");
         getch();
         break;

      case 2:
         printf("\nEnter a String:");
         gets(a);
         reverse(a);
         printf("\nResult=%s", a);
         printf("\nPress a Character");
         getch();
         break;

      case 3:
         printf("\n Enter a String:");
         gets(a);
         result = palindrome(a);
         if (result == 0)
            printf("\nNot a palindrome");
         else
            printf("\nA palindrome");
         printf("\nPress a Character");
         getch();
         break;

      case 4:
         printf("\nEnter a String:");
         gets(a);
         copy(b, a);
         printf("\nResult=%s", b);
         printf("\nPress a Character");
         getch();
         break;

      case 5:
         printf("\nEnter 1st string:");
         gets(a);
         printf("\nEnter 2nd string:");
         gets(b);
         result = compare(a, b);
         if (result == 0)
            printf("\nboth are same");
         else if (result > 0)
            printf("\n1st>2nd");
         else
            printf("\n1st<2nd");
         printf("\nPress a Character");
         getch();
         break;

      case 6:
         printf("\nEnter 1st string:");
         gets(a);
         printf("\nEnter 2nd string:");
         gets(b);
         concat(a, b);
         printf("\nresult=%s", a);
         printf("\nPress a Character");
         getch();
         break;

      case 7:
         printf("\nEnter 1st string:");
         gets(a);
         printf("\nEnter 2nd string:");
         gets(b);
         search(a, b);
         printf("\nPress a Character");
         getch();
         break;

      case 8:
         printf("\nEnter a string:");
         gets(a);
         count(a);
         printf("\nPress a Character");
         getch();
         break;

      default:
         printf("\nInvalid Choice:");
         break;
      }

   } while (option != 9);
}

int length(char str[]) {
   int i = 0;
   while (str[i] != '\0')
      i++;
   return (i);
}

void reverse(char str[]) {
   int i, j;
   char temp;
   i = j = 0;
   while (str[j] != '\0')
      j++;
   j--;
   while (i < j) {
      temp = str[i];
      str[i] = str[j];
      str[j] = temp;
      i++;
      j--;
   }
}

int palindrome(char str[]) {
   int i, j;
   i = j = 0;
   while (str[j] != '\0')
      j++;
   while (i < j) {
      if (str[i] != str[j - 1])
         return (0);
      i++;
      j--;
   }
   return (1);
}

void copy(char str2[], char str1[]) {
   int i = 0;
   while (str1[i] != '\0') {
      str2[i] = str1[i];
      i++;
   }
   str2[i] = '\0';
}

int compare(char str1[], char str2[]) {
   int i;
   i = 0;
   while (str1[i] != '\0') {
      if (str1[i] > str2[i])
         return (1);
      if (str1[i] < str2[i])
         return (-1);
      i++;
   }
   return (0);
}

void concat(char str1[], char str2[]) {
   int i, j;
   i = 0;
   while (str1[i] != '\0')
      i++;
   for (j = 0; str2[j] != '\0'; i++, j++)
      str1[i] = str2[j];
   str1[i] = '\0';
}

void search(char str1[], char str2[]) {
   int i, j, lena, lenb;
   for (lena = 0; str1[lena] != '\0'; lena++);
   for (lenb = 0; str2[lenb] != '\0'; lenb++);

   for (i = 0; i <= lena - lenb + 1; i++) {
      for (j = 0; str1[i + j] == str2[j] && str2[j] != '\0'; j++);
      if (str2[j] == '\0')
         printf("\nString found at location : %d", i + 1);
   }
}

void count(char str[]) {
   int words = 0, characters = 0, spchar = 0, i;
   for (i = 0; str[i] != '\0'; i++) {
      if (isalnum(str[i]) && (i == 0 || !isalnum(str[i - 1])))
         words++;
      characters++;
      if (!isalnum(str[i]) && !isspace(str[i]))
         spchar++;
   }
   printf("\nNo of characters = %d", characters);
   printf("\nNo of special characters = %d", spchar);
   printf("\nNo of words = %d", words);
}

Output:
1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:1
Enter a String:pritesh
Length of pritesh=7
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:2
Enter a String:pritesh
Result = hsetirp
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:3
Enter a String:madam
A palindrome
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:4
Enter a String:pritesh
Result=pritesh
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:5
Enter 1st string:pri
Enter 2nd string:pri
both are same
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:6
Enter 1st string:prite
Enter 2nd string:sh
result=pritesh
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:7
Enter 1st string:pritesh
Enter 2nd string:pri
String found at location : 1
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:8
Enter a string:pri@20110
No of characters = 9
No of special characters = 1
No of words = 2
Press a Character

1.Length of a string
2.Reverse the Given String
3.Check for Palindrome
4.Copy
5.String Comparison
6.String Concatenation
7.String Searching
8.Counting of Words,Characters & Special Characters
9.Quit

Enter Your Choice:9


Comments

Popular posts from this blog

I YEAR - ICT - UNIT 5