SlideShare une entreprise Scribd logo
1  sur  3
NOT IN C but in Assembly language SPARC converting a string to lowercase and counting the
length.
Write a program that accepts a string from the user. You can assume the length of the string will
be less than 30 characters and only alphabetical letters are entered.
Your program should then prompt the user to enter a letter (either lower case or upper case).
After this, you should 1) display the string with only lower case letters, 2) display the length of
the string, 3) count the number of occurrences of the letter entered (upper or lower case), 4) store
the string with the letter removed (upper and lower case occurrences) and display the shortened
string, and 5) ask the user if they want to continue or not. Error checking on user input is
required for the single letter input and the option to continue or not.
Solution
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
char c[20];
int i,j,len;
clrscr();
printf(" Enter the string: ");
gets(c);
len=strlen(c);
for(i=0;i<len;i++)
{
for(j=0;j<=i;j++)
{
printf("%c",c[j]);
}
printf(" ");
}
for(i=len-1;i>0;i--)
{
for(j=0;j<i;j++)
{
printf("%c",c[j]);
}
printf(" ");
}
getch();
}
//OUTPUT:
//Enter the string: abcd
a
ab
abc
abcd
abc
ab
a
Posted by Vinit Jain at Tu

Contenu connexe

Similaire à NOT IN C but in Assembly language SPARC converting a string to lowerca.docx

Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cError correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cMd Nazmul Hossain Mir
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdfSergiuMatei7
 
Write a parallel program using MPI and not OpeMP to accomp.pdf
Write a parallel program using MPI and not OpeMP to accomp.pdfWrite a parallel program using MPI and not OpeMP to accomp.pdf
Write a parallel program using MPI and not OpeMP to accomp.pdfaaryanentp
 
(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercisesNico Ludwig
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxSonu62614
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxjaggernaoma
 
Please write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdfPlease write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdffazilfootsteps
 
This code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfThis code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfadmin447081
 
Please help. C++ The program is an interactive program th.pdf
Please help. C++ The program is an interactive program th.pdfPlease help. C++ The program is an interactive program th.pdf
Please help. C++ The program is an interactive program th.pdffsenterprises
 

Similaire à NOT IN C but in Assembly language SPARC converting a string to lowerca.docx (15)

Unit1 C
Unit1 CUnit1 C
Unit1 C
 
Error correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-cError correction-and-type-of-error-in-c
Error correction-and-type-of-error-in-c
 
Programming in C - interview questions.pdf
Programming in C - interview questions.pdfProgramming in C - interview questions.pdf
Programming in C - interview questions.pdf
 
Write a parallel program using MPI and not OpeMP to accomp.pdf
Write a parallel program using MPI and not OpeMP to accomp.pdfWrite a parallel program using MPI and not OpeMP to accomp.pdf
Write a parallel program using MPI and not OpeMP to accomp.pdf
 
C Programming Unit-3
C Programming Unit-3C Programming Unit-3
C Programming Unit-3
 
CP Handout#8
CP Handout#8CP Handout#8
CP Handout#8
 
(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises(4) cpp automatic arrays_pointers_c-strings_exercises
(4) cpp automatic arrays_pointers_c-strings_exercises
 
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docxShad_Cryptography_PracticalFile_IT_4th_Year (1).docx
Shad_Cryptography_PracticalFile_IT_4th_Year (1).docx
 
C programming part4
C programming part4C programming part4
C programming part4
 
C programming part4
C programming part4C programming part4
C programming part4
 
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docxINPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
INPUT AND OUTPUT PROCESSINGPlease note that the material o.docx
 
Please write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdfPlease write a code in JAVA to do line editor..Your program will b.pdf
Please write a code in JAVA to do line editor..Your program will b.pdf
 
This code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdfThis code i would want to work ssh compiling for the this ta.pdf
This code i would want to work ssh compiling for the this ta.pdf
 
Unit - 1.ppt
Unit - 1.pptUnit - 1.ppt
Unit - 1.ppt
 
Please help. C++ The program is an interactive program th.pdf
Please help. C++ The program is an interactive program th.pdfPlease help. C++ The program is an interactive program th.pdf
Please help. C++ The program is an interactive program th.pdf
 

Plus de scroghamtressie

Name four services that might allow you to control a VM in an IaaS env.docx
Name four services that might allow you to control a VM in an IaaS env.docxName four services that might allow you to control a VM in an IaaS env.docx
Name four services that might allow you to control a VM in an IaaS env.docxscroghamtressie
 
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docx
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docxmus101 What musical techniques did Vivaldi use in La Primavera to depi.docx
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docxscroghamtressie
 
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docx
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docxMust every revolution end in tyranny (as suggested by Ignazio Silone)-.docx
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docxscroghamtressie
 
Multiple Choice Question The information in the following table is fro.docx
Multiple Choice Question The information in the following table is fro.docxMultiple Choice Question The information in the following table is fro.docx
Multiple Choice Question The information in the following table is fro.docxscroghamtressie
 
Mips assembly language Generate the quadruples for the program code fr.docx
Mips assembly language Generate the quadruples for the program code fr.docxMips assembly language Generate the quadruples for the program code fr.docx
Mips assembly language Generate the quadruples for the program code fr.docxscroghamtressie
 
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxMicrosoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxscroghamtressie
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxscroghamtressie
 
Match the words in the left column to the appropriate blanks in the se.docx
Match the words in the left column to the appropriate blanks in the se.docxMatch the words in the left column to the appropriate blanks in the se.docx
Match the words in the left column to the appropriate blanks in the se.docxscroghamtressie
 
Nathanson Corporation was organized on May 1- 2014- The following even.docx
Nathanson Corporation was organized on May 1- 2014- The following even.docxNathanson Corporation was organized on May 1- 2014- The following even.docx
Nathanson Corporation was organized on May 1- 2014- The following even.docxscroghamtressie
 
Match the following aqueous solutions with the appropriate letter from (4).docx
Match the following aqueous solutions with the appropriate letter from (4).docxMatch the following aqueous solutions with the appropriate letter from (4).docx
Match the following aqueous solutions with the appropriate letter from (4).docxscroghamtressie
 

Plus de scroghamtressie (10)

Name four services that might allow you to control a VM in an IaaS env.docx
Name four services that might allow you to control a VM in an IaaS env.docxName four services that might allow you to control a VM in an IaaS env.docx
Name four services that might allow you to control a VM in an IaaS env.docx
 
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docx
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docxmus101 What musical techniques did Vivaldi use in La Primavera to depi.docx
mus101 What musical techniques did Vivaldi use in La Primavera to depi.docx
 
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docx
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docxMust every revolution end in tyranny (as suggested by Ignazio Silone)-.docx
Must every revolution end in tyranny (as suggested by Ignazio Silone)-.docx
 
Multiple Choice Question The information in the following table is fro.docx
Multiple Choice Question The information in the following table is fro.docxMultiple Choice Question The information in the following table is fro.docx
Multiple Choice Question The information in the following table is fro.docx
 
Mips assembly language Generate the quadruples for the program code fr.docx
Mips assembly language Generate the quadruples for the program code fr.docxMips assembly language Generate the quadruples for the program code fr.docx
Mips assembly language Generate the quadruples for the program code fr.docx
 
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docxMicrosoft Visual C# 2012- An introduction to object-oriented programmi.docx
Microsoft Visual C# 2012- An introduction to object-oriented programmi.docx
 
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docxMerge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
Merge sort in CSolution#include-stdio-h- #define MAX 50 void mergeSort.docx
 
Match the words in the left column to the appropriate blanks in the se.docx
Match the words in the left column to the appropriate blanks in the se.docxMatch the words in the left column to the appropriate blanks in the se.docx
Match the words in the left column to the appropriate blanks in the se.docx
 
Nathanson Corporation was organized on May 1- 2014- The following even.docx
Nathanson Corporation was organized on May 1- 2014- The following even.docxNathanson Corporation was organized on May 1- 2014- The following even.docx
Nathanson Corporation was organized on May 1- 2014- The following even.docx
 
Match the following aqueous solutions with the appropriate letter from (4).docx
Match the following aqueous solutions with the appropriate letter from (4).docxMatch the following aqueous solutions with the appropriate letter from (4).docx
Match the following aqueous solutions with the appropriate letter from (4).docx
 

Dernier

Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxheathfieldcps1
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...christianmathematics
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxDenish Jangid
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.pptRamjanShidvankar
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdfQucHHunhnh
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104misteraugie
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfPoh-Sun Goh
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxRamakrishna Reddy Bijjam
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701bronxfugly43
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Dernier (20)

INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptxINDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
INDIA QUIZ 2024 RLAC DELHI UNIVERSITY.pptx
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptxBasic Civil Engineering first year Notes- Chapter 4 Building.pptx
Basic Civil Engineering first year Notes- Chapter 4 Building.pptx
 
Application orientated numerical on hev.ppt
Application orientated numerical on hev.pptApplication orientated numerical on hev.ppt
Application orientated numerical on hev.ppt
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104Nutritional Needs Presentation - HLTH 104
Nutritional Needs Presentation - HLTH 104
 
Asian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptxAsian American Pacific Islander Month DDSD 2024.pptx
Asian American Pacific Islander Month DDSD 2024.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701ComPTIA Overview | Comptia Security+ Book SY0-701
ComPTIA Overview | Comptia Security+ Book SY0-701
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

NOT IN C but in Assembly language SPARC converting a string to lowerca.docx

  • 1. NOT IN C but in Assembly language SPARC converting a string to lowercase and counting the length. Write a program that accepts a string from the user. You can assume the length of the string will be less than 30 characters and only alphabetical letters are entered. Your program should then prompt the user to enter a letter (either lower case or upper case). After this, you should 1) display the string with only lower case letters, 2) display the length of the string, 3) count the number of occurrences of the letter entered (upper or lower case), 4) store the string with the letter removed (upper and lower case occurrences) and display the shortened string, and 5) ask the user if they want to continue or not. Error checking on user input is required for the single letter input and the option to continue or not. Solution #include<stdio.h> #include<conio.h> #include<string.h> void main() { char c[20]; int i,j,len; clrscr(); printf(" Enter the string: "); gets(c);