Computer Science, asked by ramsmedicine, 13 days ago

.Store your favourite subject's name in a variable. Write a program to join that variable to a proper sentence and print it.

Example: "My favourite subject is Computer Science


pls answer why u r not answering

Answers

Answered by Anonymous
25

Storing favourite subject name - Python

What we need to do

We would take a user input string first, to store favourite subject's name in a variable.

We know that the input() function returns a string, string is one of the basis types in Python that store text.

We then join that variable and we print the result.

\rule{300}{1}

The Program

subject=input('Enter your favourite subject name:')

print("My favourite subject is, subject")

\rule{300}{1}

Sample Run

Enter your favourite subject name: Computer Science

My favourite subject is Computer Science

Answered by BrainlyProgrammer
2

Answer:

#Done in python...

k=input("What is your favourite subject?")

print("Your favourite subject is ",k)

//JAVA

import java.util.*;

class abc{

public static void main (String ar []){

Scanner sc=new Scanner(System.in);

System.out.println("What's your favourite subject?");

k=sc.nextLine();

System.out.println("Your favourite subject is "+k);

}

}

Similar questions