#include <stdio.h>
#include <conio.h>
int main()
{
int x, y, *p, *q, sum;
printf(" Enter two integers to add " );
scanf(" %d %d ", &x, &y );
p = &x;
q = &y;
sum = *p + *q;
printf(" Sum of entered numbers = %d\n ", sum );
getch();
return 0;
}
OUTPUT:
Enter two integers to add 3
6
Sum of entered numbers = 9
Sample C Program To Print Floyd’s Triangle.
#include <stdio.h>
#include <conio.h>
main()
{
int n, i, c, number = 1;
printf(" Enter the number of rows of Floyd's triangle you want " );
scanf(" %d ", &n );
for ( i = 1 ; i <= n ; i++ )
{
for ( c = 1 ; c <= i ; c++ )
{
printf(" %d ", number );
number++;
}
printf(" \n " );
}
getch();
return 0;
}
OUTPUT:
Enter the number of rows of Floyd’s triangle you want 6
1
2 3
4 5 6
7 8 9 10
11 12 13 14 15
16 17 18 19 20 21
ALSO READ:
-- Program To Understand Working Of Address Concept.
-- Program On Use Of Array & Pointer Concept Together.
-- Program On Pointers & 2 - Dimensional Array.
-- Program On Strings Into Array Of Pointers.
-- Program To Accept & Add Ten Numbers Using Pointers.
-- Program To Implement Minimum Spanning Tree Using Functions, Pointers & Structures.
-- Program To Implement 8 Queens Problem Using Arrays, Pointers & Functions.
-- Program To Implement Quick Sort Using Pointers, Functions & Arrays.
-- Program With Algorithm To Implement Bubble Sort Using Pointers.
-- Program To Implement Recursive Algorithm Using Pointers.
-- Program On Strings Into Array Of Pointers.
-- Program On Pointers & 2 - Dimensional Array.
-- Program On Use Of Array & Pointer Concept Together.
-- Program On Arithmetic Calculations Using Pointers.
-- Program To Add Two Numbers Using Pointers.
-- Program To Accept & Add Ten Numbers Using Pointers.
... Back To C++ Programs Index
... Back To C++ FAQ's Index
... Back To C Programs Index
... Back To C FAQ's Index
... Back To HR Interview Index
The program output is wrong
ReplyDeleteit prints
1
1 2
1 2 3
1 2 3 4
............
like this
no it prints correctly
DeleteYes, Answer is corret..
ReplyDeletekumar:Yes, Answer is corret..
ReplyDelete