#include<conio.h> #include<iostream.h> void main() { clrscr();
int sum=0,i,num; cout<<"Enter a number"; cin>>num; for(i=1;i<=num;i++) { sum=sum+i; } cout<<"Sum of "<<num<<"natural numbers = " <<sum;
getch(); }
#include<stdio.h> int main() { int a[10],M=0,i,n; printf("enter a value for n\n"); scanf("%d",&n); fo...
No comments:
Post a Comment