Computer Science, asked by Anonymous, 6 months ago


{ \huge\fbox \pink {Q}\fbox \blue {u} \fbox\purple {e} \fbox \green{s} \fbox \red {t} \fbox \orange {i} \fbox{o} \fbox \gray{n}}


4. Write the syntax for scanf () statement.

5. Write the syntax for printf() statement.

6. What is the difference between scanf() and gets()?

7. Explain puts() function.

8. Write the syntax for
a) getchar()
b) putchar()


NO SPAMMING ❌❌❌
SPAMMERS MAINTAIN A DISTANCE KI!!!!

Answers

Answered by Anonymous
3

Answer:

4.The scanf("%d",&number) statement reads integer number from the console and stores the given value in number variable. The printf("cube of number is:%d ",number*number*number) statement prints the cube of number on the console.

5.Syntax. int printf (const char* c-string, ...); Return Value: If the function successfully executes, it returns the total number of characters written to the standard output. If an error occurs, a negative number is returned.

6.The main difference between them is: scanf() reads input until it encounters whitespace, newline or End Of File(EOF) whereas gets() reads input until it encounters newline or End Of File(EOF), gets() does not stop reading input when it encounters whitespace instead it takes whitespace as a string

7.puts() function is a file handling function in C programming language which is used to write a line to the output screen. ... puts() function is used to write a line to the output screen. In a C program, we use puts function as below. puts(string);

8.(a)getchar () function reads character from keyboard

(b)putchar () function writes a character to screen

Explanation:

mark as brainliest.........

Answered by Anonymous
2

✨ANSWER✨

4.Ans: #include <stdio.h>

int main () {

char str1[20], str2[30];

printf("Enter name: ");

scanf("%s", str1);

printf("Enter your website name: ");

scanf("%s", str2);

printf("Entered Name: %s\n", str1);

printf("Entered Website:%s", str2);

return(0);

}

5.Ans: #include <stdio.h>

int main()

{

float number1 = 13.5;

double number2 = 12.4;

printf("number1 = %f\n", number1);

printf("number2 = %lf", number2);

return 0;

}

Output

number1 = 13.500000

number2 = 12.400000

6.Ans: The main difference between them is: scanf() reads input until it encounters whitespace, newline or End Of File(EOF) whereas gets() reads input until it encounters newline or End Of File(EOF), gets() does not stop reading input when it encounters whitespace instead it takes whitespace as a string

7.Ans: Puts is an inbuilt function that writes a line of output to the screen. It returns the number of characters that are written to the console plus one as it prints a new line along with the output text thereby moving the cursor to the new line. Its return type is int.

8.Ans: putchar() Declaration: int putchar(int char)

putchar() function is used to write a character on standard output/screen. In a C program, we can use putchar function as below.

putchar. (char);

where, char is a character variable/value.

getchar() Declaration: int getchar(void)

getchar() function is used to get/read a character from keyboard input.In Cprogram we can use getchar function as below.

getchar(char); where, char is a character variable/value.

HOPE YOU'RE SATISFIED WITH MY ANSWER

Similar questions