0% found this document useful (0 votes)
14 views1 page

C Programs for Name and Sum Input

The document provides three C programming examples: the first prints a predefined name, the second takes user input to print a name, and the third adds two user-input integers and displays the sum. Each example includes the necessary code and expected output. The document serves as a basic introduction to using printf and scanf functions in C.

Uploaded by

laxmiadapala1205
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

C Programs for Name and Sum Input

The document provides three C programming examples: the first prints a predefined name, the second takes user input to print a name, and the third adds two user-input integers and displays the sum. Each example includes the necessary code and expected output. The document serves as a basic introduction to using printf and scanf functions in C.

Uploaded by

laxmiadapala1205
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

1 wap to print your name?

#include <stdio.h>
int main()
{
printf("Name : PNR INSTITUTE");
return 0;
}

O/P: PNR institute

2. wap to print on console your name?


==> our own name using scanf() function

#include <stdio.h>
int main()
{
char name[20];
printf("Enter name: ");
scanf("%s", name);
printf("Your name is %s.", name);
return 0;
}

User input :

3. w a p to add two numbers taking user input?

#include <stdio.h>

int main(void)
{
int number1, number2, sum;

printf("Enter two integers: ");


scanf("%d %d", &number1, &number2);
sum = number1 + number2;
printf("%d + %d = %d", number1, number2, sum);
return 0;
}}

You might also like