The answer is the alu arithmetic logic unit.
Answer:
Check the explanation
Explanation:
#include<iostream.h>
#include<stdlib.h>
void append(char* first,int n,char* second, int n1,char* result)
{
int i,j=0;
for(i=0;i<n;i++)
result[i]=first[i];
for(i=n;i<n1+n;i++)
{
result[i]=second[j];
j++;
}
}
void main()
{
char first[]={'I', ' ','a', 'm', ' '};
char second[]={'i', 'r', 'o', 'n', 'm', 'a', 'n','\0'};
char result[200];
append(first,5,second, 8, result);
cout<<result;
cout<<endl;
system("pause");
}
Answer:
Explanation:
The following code is written in Java. It asks the user for an input and saves it in a String variable. Then it loops through all the characters in the string and counts the spaces. Finally, it prints the total number of spaces in the String.
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.println("Enter Line Now:");
String userInput = in.nextLine();
int spaceCount = 0;
for (int x = 0; x < userInput.length(); x++) {
if (userInput.charAt(x) == ' ') {
spaceCount++;
}
}
System.out.println(spaceCount);
}