Question

In: Computer Science

Print the message “ I start to learn a C – Program “ on two lines...

  1. Print the message “ I start to learn a C – Program “ on two lines where the first line ends with “learn”.
  2. Write a full C program to output following printf statement.

Printf (“ This \nis\na\nC\nprogram. \n”);

  1. Write a C program to output following printf statement.

Printf(“\n This is \ a \n C program. “) ;

  1. Write a program that prints the numbers 1 to 4 on same lines after one blank line.
  2. Write a program to display following block letters.

C   C   C C   C

      C

           C

                C

  1. Calculate mean of given 3 numbers: 45, 55, 65.(Division operator is /).
  2. Using if, evaluate whether a number entered by the keyboard is greater or less than 10.

Solutions

Expert Solution

Solution:

#include <stdio.h>
int main(void) 
{
  /*Print the message “ I start to learn a C – Program “ on two lines where the first line ends with “learn”.*/
  printf(" I start to learn\n a C – Program ");
  printf (" \nThis \nis\na\nC\nprogram. \n");
  printf("\n This is  a \n C program. ") ;
  printf("\nC\tC\tC\tC\tC\n");
  printf("\tC\n");
  printf("\t\tC\n");
  printf("\t\t\tC\n");
  int a = 45, b = 55, c = 65, n;
  float mean = (float)(a+b+c)/3;
  printf("\nMean of three numbers: %f", mean);
  printf("\nEnter a number: "); 
  scanf("%d", &n);
  if(n>10)
    printf("\nNumber is greater than 10.");
  else
    printf("\nNumber is less than 10.");
  return 0;
}

Output:

Please give thumbsup, or do comment in case of any query. Thanks.


Related Solutions

New to C programming and I am stuck. The program will print "no input" if no...
New to C programming and I am stuck. The program will print "no input" if no input is given. If a command line argument is given the program will print "input:" followed by the user input. Below is the code I put together to do as desired but I get errors. What do I need to fix to get my code to compile correctly? #include <stdio.h> #include <stdlib.h> int main () { char input; scanf("%c", &input); if (input == NULL)...
Whenever I am attempting to write a simple program on C++ I get an error message...
Whenever I am attempting to write a simple program on C++ I get an error message that reads "cout was not declared in this scope". Literally every time. This has become frustrating because I have even written my code the exact same way as some of my classmates who got theirs to compile and run with no sign of this error at all, and yet min gives this answer. I will leave an example of a code where this error...
Implement a Message Authentication Code program in either C/C++ or Python. 1. Accept a message as...
Implement a Message Authentication Code program in either C/C++ or Python. 1. Accept a message as keyboard input to your program. 2. Accept a secret key for the sender/recipient as keyboard input to your program. 3. Your hash function H() is simply the checksum. To compute the checksum, you add all the characters of the string in ASCII codes. For example, the checksum of a string "TAMUC" would be 84 + 65 + 77 + 85 + 67 = 378....
In C++ Instructions: Use a void function to print the following message (should be in welcome...
In C++ Instructions: Use a void function to print the following message (should be in welcome function) Welcome to the Event Scheduling program create 3 int arrays with 3 positions (one array for days one array for moths and one array for years) (should be in main) Create a file that contains the following (you can just create the file or write the file in the program) 1 / 26 / 2021 12 / 13 / 2020 2 / 1...
Instructions (in C++): 1 ) Use a void function to print the following message (should be...
Instructions (in C++): 1 ) Use a void function to print the following message (should be in welcome function) Welcome to the Event Scheduling program 2 ) create 3 int arrays with 3 positions (one array for days one array for moths and one array for years) (should be in main) 3 ) Create a file that contains the following (you can just create the file or write the file in the program) 1 / 26 / 2021 12 /...
Write a C++ program to multiply two matrices a and b and print the result. Use...
Write a C++ program to multiply two matrices a and b and print the result. Use two-dimensional arrays to represent the matrices.
Write an assembly language program that will print out the message of your choosing #NOTE #write...
Write an assembly language program that will print out the message of your choosing #NOTE #write in a simple way, so that i can execute it from command window using masm
Write java program that will ask for the user for 2 input lines and print out...
Write java program that will ask for the user for 2 input lines and print out all words that occur 1 or more times on both lines (case sensitive). Write this without arrays and method. Here is a sample run: <Output> Enter two lines to process. The quick brown fox jumps over a lazy dog The fox hound outruns the lazy dog The words that occur on both lines are: The fox lazy dog
Need to write a c program Program prints a message telling the user to push a...
Need to write a c program Program prints a message telling the user to push a key to start the game. Once in game, output tells the player which key to push. The key to press should be determined randomly. Game runs continuously until the user reaches a loose condition. A wrong key is pressed
write a C program which performs encryption and decryption of a message
write a C program which performs encryption and decryption of a message
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT