Wednesday, 23 December 2020

Write a Program in C++ to Accept a Word and Display it vertically.

 #include <iostream>

using namespace std;

main()

{

    string s; int i;

    cout<<"Enter a word or a sentence\n";

    cin>>s;

    for(i=0;i<s.length();i++)

    cout<<s.at(i)<<"\n";

}

No comments:

Post a Comment

Java Program to count the total number of characters in a string

 //Java Program to count the total number of characters in a string import java.util.*; public class CountChars {     public static void mai...