Professional Documents
Culture Documents
Ans:
a. Baa Baa Black Sheep.Have you any wool?
b. Begone!
O creature of lard!
c. What?
No/nfish?
d. 2+2 = 4
#include <stdio.h>
intmain() {
int legs, cows;
printf("How many cow legs did you count?\n");
scanf("%d", & legs);
cows = legs / 4;
printf("That implies there are %d cows.\n", cows);
return 0;
}
Programming operating:
1. Write a C program that prints your first and last name in the console window.
Your first name should appear on one line, and your last name appear on the
next line.
int main() {
printf("MD IMRAN\n");
printf("HOSSAIN\n");
return 0;
}
2. Write a program that uses one printf() call to print your first name and last
name on one line, uses a second printf() call to print your first and last names on two
separate lines, and uses a pair of printf() calls to print your first and last names on one
line. The output should look like this (but using your name):
Solution
int main()
{
printf("Gustav Mahler\n"); // First print statement
printf("Gustav\n"); // Second print statement
printf("Mahler\n"); // Still the second print statement
printf("Gustav "); // Third print statement
printf("Mahler\n"); // Fourth print statement
return 0;
}