Question

Language is C programming Student ID should be 8 numbers long. create a program to read...

Language is C programming

Student ID should be 8 numbers long.

create a program to read your student ID number and store it in an array.

Input can not be hard wired, I have to be able to input my number
Then change the first number to a letter. If the same number repeats in other parts of your student ID, you must change that number to a letter as well.
print original array and modified array as your output.

Number to letter correspondence; 1=a, 2=b, 3=c, 4=d,5=e,6=f,7=g,8=h,9=i,0=j
i.e. if student id is 123583021
then outuput should look something like this
original = 123583021
modified = a2358302a (if you are really good is would be a2358302A)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

CODE:

#include<stdio.h>
#include<stdlib.h>
int main(){
   char c[100];//array size
   scanf("%s",&c);//taking input from the user
   char s[100];//temperory array for storing the result
   int i;//variable for iterations in the loop
   int x=c[0];//variable that stores the first letter of the string
   for(i=0;i<sizeof(c);i++){//loop traversing entire string
       s[i]=c[i];//for copying letters to s i.e. Modified string
          
           if(s[i]==x){//checking modified string's first letter      
               if(x=='0'){//checks if the first letter is 0
                   s[i]='j';// if x=0, it prints j in the place of 0
               }
               else{
                   s[i]=(97+(x-49));//prints the modified string with the letters as per the output required
               }
           }  
   }
   printf("Original string:%s\n",c);
   printf("Modified string:%s",s);
}

1 2 3 #include<stdio.h> #include<stdlib.h> int main() { char c[100];//array size scanf(%s,&c);//taking input from the user

OUTPUT:

D:\c\Untitled1.exe 123583021 Original string: 123583021 Modified string:a2358302a - - - - - - - - - - - - - - - - - - - - - -

For any queries comment and hit like.Thank You

Add a comment
Know the answer?
Add Answer to:
Language is C programming Student ID should be 8 numbers long. create a program to read...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Answer should be in C programming language Write a program that will create an array of...

    Answer should be in C programming language Write a program that will create an array of 10 floating point numbers and take input 10 floats from keyboard. The program will print the position (index) of the maximum and minimum number among them

  • Kindly solve this using C PROGRAMMING ONLY. 4. Write a program marks.c which consists of a...

    Kindly solve this using C PROGRAMMING ONLY. 4. Write a program marks.c which consists of a main function and three other functions called. readmarks , changemarks (, and writemarks() The program begins by calling the function readmarks () to read the input file marksin. txt which consists of a series of lines containing a student ID number (an integer) and a numeric mark (a float). Once the ID numbers and marks have been read into arrays (by readmarks () the...

  • You will create a class to keep student's information: name, student ID, and grade. The program...

    You will create a class to keep student's information: name, student ID, and grade. The program will have the following functionality: - The record is persistent, that is, the whole registry should be saved on file upon exiting the program, and after any major change. - The program should provide the option to create a new entry with a student's name, ID, and grade. - There should be an option to lookup a student from his student ID (this will...

  • In C++, write a complete program that receives a series of student records from the keyboard...

    In C++, write a complete program that receives a series of student records from the keyboard and stores them in three parallel arrays named studentID and courseNumber and grade. All arrays are to be 100 elements. The studentID array is to be of type int and the courseNumber and grade arrays are to be of type string. The program should prompt for the number of records to be entered and then receive user input on how many records are to...

  • this is in C programming language 1. Write a printf or scanf statement for each of...

    this is in C programming language 1. Write a printf or scanf statement for each of the following: a) Print unsigned integer 1001 right justified in a 10-digit field with 5 digits. b) Read a hexadecimal value into variable hex. c) Print 300 with and without a sign. .d) Print 200 in hexadecimal form preceded by Ox. e) Read characters into array m until the letter z is encountered. f) Print 7.350 in a 7-digit field with preceding zeros. B)...

  • Using C programming For this project, you have been tasked to read a text file with student grade...

    Using C programming For this project, you have been tasked to read a text file with student grades and perform several operations with them. First, you must read the file, loading the student records. Each record (line) contains the student’s identification number and then four of the student’s numerical test grades. Your application should find the average of the four grades and insert them into the same array as the id number and four grades. I suggest using a 5th...

  • C Programming For this task, you will have to write a program that will prompt the...

    C Programming For this task, you will have to write a program that will prompt the user for a number N. Then, you will have to prompt the user for N numbers, and print then print the sum of the numbers. For this task, you have to create and use a function with the following signature: int sum(int* arr, int n); Your code should look something like this (you can start with this as a template: int sum(int* arr, int...

  • Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program...

    Use c++ as programming language. The file needs to be created ourselves (ARRAYS) Write a program that contains the following functions: 1. A function to read integer values into a one-dimensional array of size N. 2. A function to sort a one-dimensional array of size N of integers in descending order. 3. A function to find and output the average of the values in a one dimensional array of size N of integers. 4. A function to output a one-dimensional...

  • Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student...

    Create a new NetBeans project called PS1Gradebook. Your program will simulate the design of a student gradebook using a two-dimensional array. It should allow the user to enter the number of students and the number of assignments they wish to enter grades for. This input should be used in defining the two-dimensional array for your program. For example, if I say I want to enter grades for 4 students and 5 assignments, your program should define a 4 X 5...

  • Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program...

    Please help with this Intro to programming in C assignment! Intro to Programming in C-Large Program 3 - Hangman Game Assignment purpose: User defined functions, character arrays, c style string member functions Write an interactive program that will allow a user to play the game of Hangman. You will need to: e You will use four character arrays: o one for the word to be guessed (solution) o one for the word in progress (starword) o one for all of...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT