Home SEO Tools HTML Escape Tool Character Counter Guest post

C program to add numbers using pointers

0 comments


#include<stdio.h>  
#include<conio.h>
void main()
{
int a[10],sum=0;
int *j;
int i,n;
clrscr();
printf("How many elements you want to add:");
scanf("%d",&n);
printf("Enter element:");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
j=&a[0];
for(i=0;i<n;i++)
{
sum=sum+*j;
j++;
}
printf("sum=%d",sum);
}

Do you like this Tutorial? Please link back to this article by copying one of the codes below.

URL: HTML link code: BB (forum) link code:

No comments:

FAQs | Privacy Policy | Contact | | Advertise | Donate