ii) Write a program to display following pattern using user-defined
function.
*
* *
* * *
* * * *
Answers
Answer:
#include <stdio.h>
#include <stdio.h>int addNumbers(int a, int b); // function prototype
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main()
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum;
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: ");
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2);
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum);
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition {
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition { int result;
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition { int result; result = a+b;
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition { int result; result = a+b; return result; // return statement
#include <stdio.h>int addNumbers(int a, int b); // function prototypeint main(){ int n1,n2,sum; printf("Enters two numbers: "); scanf("%d %d",&n1,&n2); sum = addNumbers(n1, n2); // function call printf("sum = %d",sum); return 0;}int addNumbers(int a, int b) // function definition { int result; result = a+b; return result; // return statement}
hope it helps u dear