
if(s[i]==' ')
{
printf("\n");
}
}
}
c. Displays the message "Hello from C language", where each word is separated from the other tab.
Exercise 4 :
What is the result of the following code:
#include <stdio.h>
void main()
{
printf (“ \n * * \n * * * * \n * * * * *”);
}
Exercise 5 :
Write a program that displays the letter B as follows :
* * * * *
* *
* *
* * * * *
* *
* *
* * * * *
/ C++ implementation to print the
// pattern of alphabets A to Z using *
#include <stdio.h>
// Below height and width variable can be used
// to create a user-defined sized alphabet's pattern
// Number of lines for the alphabet's pattern
int height = 5;
// Number of character width in each line
int width = (2 * height) - 1;
// Function to find the absolute value
// of a number D
int abs(int d)
{
return d < 0 ? -1 * d : d;
}
// Function to print the pattern of 'B'
void printB()
{
int i, j, half = (height / 2);
for (i = 0; i < height; i++) {
printf("*");