SlideShare a Scribd company logo
1 of 3
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

More Related Content

Similar to Assembly language SPARC converting a string to lowercase and counting.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
fazilfootsteps
 
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfCode In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
aishwaryaequipment
 
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
aaryanentp
 

Similar to Assembly language SPARC converting a string to lowercase and counting.docx (11)

ODS Page Breaking
ODS Page BreakingODS Page Breaking
ODS Page Breaking
 
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
 
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
 
Ch3 Formatted Input/Output
Ch3 Formatted Input/OutputCh3 Formatted Input/Output
Ch3 Formatted Input/Output
 
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
 
(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
 
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.pdfCode In PythonFile 1 main.pyYou will implement two algorithms t.pdf
Code In PythonFile 1 main.pyYou will implement two algorithms t.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
 
Unit - 1.ppt
Unit - 1.pptUnit - 1.ppt
Unit - 1.ppt
 
Lecture 3
Lecture 3Lecture 3
Lecture 3
 
Format string
Format stringFormat string
Format string
 

More from bickerstaffinell

a) Describe two ways the researcher could minimise experimenter bias i.docx
a) Describe two ways the researcher could minimise experimenter bias i.docxa) Describe two ways the researcher could minimise experimenter bias i.docx
a) Describe two ways the researcher could minimise experimenter bias i.docx
bickerstaffinell
 
Airport Delays The problems created by increased security measures at.docx
Airport Delays The problems created by increased security measures at.docxAirport Delays The problems created by increased security measures at.docx
Airport Delays The problems created by increased security measures at.docx
bickerstaffinell
 
After reading the article on Big Bottom Market make an analysis of the.docx
After reading the article on Big Bottom Market make an analysis of the.docxAfter reading the article on Big Bottom Market make an analysis of the.docx
After reading the article on Big Bottom Market make an analysis of the.docx
bickerstaffinell
 

More from bickerstaffinell (20)

A- Imagine you were recently hired as a general manager working in a.docx
A-  Imagine you were recently hired as a general manager working in a.docxA-  Imagine you were recently hired as a general manager working in a.docx
A- Imagine you were recently hired as a general manager working in a.docx
 
a) Describe two ways the researcher could minimise experimenter bias i.docx
a) Describe two ways the researcher could minimise experimenter bias i.docxa) Describe two ways the researcher could minimise experimenter bias i.docx
a) Describe two ways the researcher could minimise experimenter bias i.docx
 
All organisations are affected to some extent by external factors and.docx
All organisations are affected to some extent by external factors and.docxAll organisations are affected to some extent by external factors and.docx
All organisations are affected to some extent by external factors and.docx
 
All the following are important uses of -ICD-11-- EXCEPT- Select one-.docx
All the following are important uses of -ICD-11-- EXCEPT- Select one-.docxAll the following are important uses of -ICD-11-- EXCEPT- Select one-.docx
All the following are important uses of -ICD-11-- EXCEPT- Select one-.docx
 
All of the following were discussed in lecture as ways teams create no.docx
All of the following were discussed in lecture as ways teams create no.docxAll of the following were discussed in lecture as ways teams create no.docx
All of the following were discussed in lecture as ways teams create no.docx
 
All of the following statements are true with respect to the bacteria.docx
All of the following statements are true with respect to the bacteria.docxAll of the following statements are true with respect to the bacteria.docx
All of the following statements are true with respect to the bacteria.docx
 
Airport Delays The problems created by increased security measures at.docx
Airport Delays The problems created by increased security measures at.docxAirport Delays The problems created by increased security measures at.docx
Airport Delays The problems created by increased security measures at.docx
 
Agency theory explains manager's behavior- Which one is false- The agm.docx
Agency theory explains manager's behavior- Which one is false- The agm.docxAgency theory explains manager's behavior- Which one is false- The agm.docx
Agency theory explains manager's behavior- Which one is false- The agm.docx
 
After studying our second case with ISIS- we should have a good unders.docx
After studying our second case with ISIS- we should have a good unders.docxAfter studying our second case with ISIS- we should have a good unders.docx
After studying our second case with ISIS- we should have a good unders.docx
 
After reading the article on Big Bottom Market make an analysis of the.docx
After reading the article on Big Bottom Market make an analysis of the.docxAfter reading the article on Big Bottom Market make an analysis of the.docx
After reading the article on Big Bottom Market make an analysis of the.docx
 
A vaccine against HIV Group of answer choices may be impossible due.docx
A vaccine against HIV    Group of answer choices may be impossible due.docxA vaccine against HIV    Group of answer choices may be impossible due.docx
A vaccine against HIV Group of answer choices may be impossible due.docx
 
Additional information for the Income Statement- 1 mterest expense of.docx
Additional information for the Income Statement- 1 mterest expense of.docxAdditional information for the Income Statement- 1 mterest expense of.docx
Additional information for the Income Statement- 1 mterest expense of.docx
 
Addison Ltd owns all of the share capital of Erin Ltd- In relation to.docx
Addison Ltd owns all of the share capital of Erin Ltd- In relation to.docxAddison Ltd owns all of the share capital of Erin Ltd- In relation to.docx
Addison Ltd owns all of the share capital of Erin Ltd- In relation to.docx
 
actually I need answers of all these questions as soon as possible ple.docx
actually I need answers of all these questions as soon as possible ple.docxactually I need answers of all these questions as soon as possible ple.docx
actually I need answers of all these questions as soon as possible ple.docx
 
accumulated depreciation A- is allocated as an expense during future p.docx
accumulated depreciation A- is allocated as an expense during future p.docxaccumulated depreciation A- is allocated as an expense during future p.docx
accumulated depreciation A- is allocated as an expense during future p.docx
 
Accounting and Economic profiss are computed differently and serve dif.docx
Accounting and Economic profiss are computed differently and serve dif.docxAccounting and Economic profiss are computed differently and serve dif.docx
Accounting and Economic profiss are computed differently and serve dif.docx
 
According to the Solow model- Suppose that an earthquake destroys most.docx
According to the Solow model- Suppose that an earthquake destroys most.docxAccording to the Solow model- Suppose that an earthquake destroys most.docx
According to the Solow model- Suppose that an earthquake destroys most.docx
 
According to Culturally-Endorsed Leadership Theory- cultures differ on.docx
According to Culturally-Endorsed Leadership Theory- cultures differ on.docxAccording to Culturally-Endorsed Leadership Theory- cultures differ on.docx
According to Culturally-Endorsed Leadership Theory- cultures differ on.docx
 
According to a study done by Nick Wilson of Otago University Wellingto.docx
According to a study done by Nick Wilson of Otago University Wellingto.docxAccording to a study done by Nick Wilson of Otago University Wellingto.docx
According to a study done by Nick Wilson of Otago University Wellingto.docx
 
A-) What is the difference between encrypting and signing in asymmetri.docx
A-) What is the difference between encrypting and signing in asymmetri.docxA-) What is the difference between encrypting and signing in asymmetri.docx
A-) What is the difference between encrypting and signing in asymmetri.docx
 

Recently uploaded

Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
Chris Hunter
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
MateoGardella
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
MateoGardella
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
SanaAli374401
 

Recently uploaded (20)

Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17  How to Extend Models Using Mixin ClassesMixin Classes in Odoo 17  How to Extend Models Using Mixin Classes
Mixin Classes in Odoo 17 How to Extend Models Using Mixin Classes
 
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...
 
Making and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdfMaking and Justifying Mathematical Decisions.pdf
Making and Justifying Mathematical Decisions.pdf
 
Paris 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activityParis 2024 Olympic Geographies - an activity
Paris 2024 Olympic Geographies - an activity
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.Gardella_Mateo_IntellectualProperty.pdf.
Gardella_Mateo_IntellectualProperty.pdf.
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
Mattingly "AI & Prompt Design: Structured Data, Assistants, & RAG"
 
Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
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
 
ICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptxICT Role in 21st Century Education & its Challenges.pptx
ICT Role in 21st Century Education & its Challenges.pptx
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
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
 
Gardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch LetterGardella_PRCampaignConclusion Pitch Letter
Gardella_PRCampaignConclusion Pitch Letter
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
An Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdfAn Overview of Mutual Funds Bcom Project.pdf
An Overview of Mutual Funds Bcom Project.pdf
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 

Assembly language SPARC converting a string to lowercase and counting.docx

  • 1. 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);