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
Answers were Sorted based on User's Feedback
Answer / vadivelt
#include<stdio.h>
#include<conio.h>
void LowrUprCase(char *ptr);
int main()
{
char ptr[100];
printf("ENTER THE NAME:\n");
gets(ptr);
LowrUprCase(ptr);
printf("\nOUTPUT: %s \n",ptr);
getch();
}
void LowrUprCase(char *ptr)
{
while(*ptr != '\0')
{
if(*ptr >= 97 && *ptr <= 122)
{
*ptr = *ptr - 32;
}
else if(*ptr >= 65 && *ptr <= 90)
{
*ptr = *ptr + 32;
}
ptr++;
}
}
Is This Answer Correct ? | 9 Yes | 3 No |
Answer / sandy880
#include<stdio.h>
#include<conio.h>
#define MAX 15
void main()
{
char arr[MAX];
int i;
clrscr();
printf("Enter your name:");
scanf("%s",arr);
for(i=0;arr[i]!='\0';i++)
{
if(arr[i]>=65&&arr[i]<=90)
{
arr[i]=arr[i]+32;
}
else if(arr[i]>=97&&arr[i]<=122)
{
arr[i]=arr[i]-32;
}
}
printf("output:%s",arr);
getch();
}
Is This Answer Correct ? | 6 Yes | 3 No |
Answer / 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 |
Answer / rakesh ranjan
#include<conio.h>
#include<stdio.h>
void main()
{
char str[20],i;
printf("enter your name:");
scanf("%s",str);
for(i=0;str[i]!='\0';i++)
{
if(str[i]<=91)
str[i]+=32;
else
str[i]-=32;
printf("%c",str[i]) ;
}
getch();
}
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / vadivelt
Hi all,
In my post, Answer #1 please change the statement in if
condition from *ptr <= 96 to *ptr <= 90
Is This Answer Correct ? | 0 Yes | 3 No |
What is the function of volatile in c language?
Given a string write a program to print all alphabetical characters in the order of their occurance first,followed by the sum of the numeric characters then followed by the special characters in the order of their occurance.
1 Answers College School Exams Tests, Wipro,
i = 25;switch (i) {case 25: printf("The value is 25 ");case 30: printf("The value is 30 "); When the above statements are executed the output will be : a) The value is 25 b) The value is 30 c) The value is 25 The value is 30 d) none
int main() { unsigned char a = 0; do { printf("%d=%c\n",a,a); a++; }while(a!=0); return 0; } can anyone please explain me output????
what type of questions arrive in interview over c programming?
How do you search data in a data file using random access method?
Explain setjmp()?
any limit on the number of functions that might be present in a C program a) max 35 functions b) max 50 functions c) no limit d) none of the above
write a proram to reverse the string using switch case?
What is the difference between near, far and huge pointers?
24.what is a void pointer? 25.why arithmetic operation can’t be performed on a void pointer? 26.differentiate between const char *a; char *const a; and char const *a; 27.compare array with pointer? 28.what is a NULL pointer? 29.what does ‘segmentation violation’ mean? 30.what does ‘Bus Error’ mean? 31.Define function pointers? 32.How do you initialize function pointers? Give an example? 33.where can function pointers be used?
Why is c called a mid-level programming language?