Tuesday, 18 September 2018

TCS NINJA CODING PROGRAM Season-2 NQT

C Program to replace lower case letters with upper case (Vice-versa) and replacing vowels with * 

Input:
First line of input contains string 1
Second line of input contains string 2
Third line of input contains string 3

Output:
First line of output were replaced by upper case letters 
Second line of output were replaced by lower case letters
Third Line of output contains * replacing vowels.

Example:

Input:
how 
ARE 
you

Output:
HOW
are
y**

SOURCE CODE:

#include<stdio.h>
#include<string.h>
int main()
{
    char str1[10],str2[10],str3[10];
    int i,j,c=0;
    gets(str1);
    gets(str2);
    gets(str3);
    
    
    for(i=0;str1[i]!='\0';i++)
    {  
        if(str1[i]>='a'&&str1[i]<='z')
        {
            str1[i]=str1[i]-32;
        }
    }
    for(i=0;str2[i]!='\0';i++)
    {  
        if(str2[i]>='A'&&str2[i]<='Z')
        {
            str2[i]=str2[i]+32;
        }
    }
  for(i=0;str3[i]!='\0';i++)
    {  
        if(str3[i]=='a'||str3[i]=='A'||str3[i]=='e'||str3[i]=='E'||str3[i]=='i'||str3[i]=='I'||str3[i]=='o'||str3[i]=='O'||str3[i]=='u'||str3[i]=='U')
        {
            str3[i]='*';
        }
    }
   
    puts(str1);
    puts(str2);
    puts(str3);
    return 0;
}

1 comment:

Random password generator in Java

       Random password generator in Java Source code: mport java.io.*; import java.util.*; public class Main { public static void main(Str...