write a c program for print your name .but,your name may be
small
letter mean print a capital letter or your name may be
capital
letter mean print a small letter .example
\\enter ur name :
sankar
The name is: SANKAR
(or)
enter your name:SAnkar
The name is:saNKAR

Answer Posted / vishnu nayak

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

int main()
{
const char *ptr;
char *temp;
int count =0;
ptr = (char*) malloc(sizeof(char)*30);
temp = (char*) malloc(sizeof(char)*30);
printf("enter the string \n");
gets(ptr);
while(*ptr != '\0')
{
if(*ptr >=65 && *ptr <= 90)
{
*temp = (*ptr)+32;
temp++;
ptr++;
}
else if(*ptr >= 97 && *ptr <= 122)
{
*temp = (*ptr)- 32;
temp++;
ptr++;
}
else
{
*temp = *ptr;
ptr++;
temp++;
}
count++;
}
*temp = '\0';
temp = temp - count;
puts(temp);

free(temp);
free(ptr);

//getch();
}

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain what are the __date__ and __time__ preprocessor commands?

594


Write a C program to accept a matrix of any size. Find the frequency count of each element in the matrix and positions in which they appear in the matrix

1518


What are the 4 types of organizational structures?

624


Describe dynamic data structure in c programming language?

604


Write a program of prime number using recursion.

617






What should malloc(0) do? Return a null pointer or a pointer to 0 bytes?

586


Why functions are used in c?

587


Explain how can I manipulate strings of multibyte characters?

782


Explain about the constants which help in debugging?

851


What is hash table in c?

574


What is use of #include in c?

597


i have a written test for microland please give me test pattern

2183


a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

613


How can a string be converted to a number?

517


Explain what is a const pointer?

640