Welcome to AMIE Study - AMIE India Students Forum

AMIE Study - AMIE India Students Forum

collapse collapse

* Shoutbox

Refresh History
  • girish_amie: Please upload electrical engineering latest question paper
    December 06, 2017, 09:25:40 AM
  • JYOTI VERMA: agr kisi ko apna exam city and center change krana hom to use kya krna chahiye plz suggest.
    October 14, 2017, 01:16:11 PM
  • JYOTI VERMA: amie ka exam center kaise change kr skte hai agr kiisi ko pta ho to plz btaiye .
    October 14, 2017, 01:15:31 PM
  • anoop.goyal9: error in online fee payment for winter 2017 examination
    October 12, 2017, 07:23:34 AM
  • ramajit: [link]
    October 06, 2017, 12:34:12 PM
  • ramajit: yes.. results announced... me 2/3 passed in Sec-B prodn Engg... xo xo... wow....
    October 06, 2017, 12:34:09 PM
  • suji.sujithraj: Guys check your results... its announced...!!!
    October 06, 2017, 10:26:53 AM
  • ramajit: summer'17 result will come or not ?
    October 06, 2017, 06:44:28 AM
  • jitu12341: Result has been declared ♡♡♡♡
    October 06, 2017, 06:30:56 AM
  • jitu12341: breaking news results will be publshed in March 18 along with winter 17
    October 04, 2017, 12:54:36 PM
  • ramajit: any tentative date aware about Summer'17 result
    October 03, 2017, 03:13:48 PM
  • nelokulood: What is the last date to apply for lab and project for winter 2017 session
    October 02, 2017, 11:39:31 AM
  • nelokulood: When will amie summer  2017 results be published
    October 02, 2017, 11:38:50 AM
  • SnrTech: please upgrade my membership to super member I already made payments Rs.500/- into bank account
    September 27, 2017, 11:17:12 PM
  • jitu12341: Is there anybody having EL 404, circuit and field theory notes  please mail on [email protected]
    September 23, 2017, 05:53:34 AM
  • jitu12341: Result is expected in first week of October
    September 23, 2017, 05:48:39 AM
  • manirock87: Result kab aayega for summer 2017
    September 22, 2017, 06:59:35 AM
  • mudassir.search007: Do i need to pay a separate fee for the Section A examination after paying the re-registration Fee (SEC A)
    September 20, 2017, 10:25:06 PM
  • kirannm: sorry just checking
    September 16, 2017, 08:07:00 PM
  • kirannm: hjhhjdfhj
    September 16, 2017, 08:06:43 PM

* Search


* User Info

 
 
Welcome, Guest. Please login or register.
Did you miss your activation email?

* Board Stats

  • stats Total Members: 48503
  • stats Total Posts: 27304
  • stats Total Topics: 6595
  • stats Total Categories: 6
  • stats Total Boards: 31
  • stats Most Online: 626

Author Topic: C program old questionpaper source code  (Read 1443 times)

Description:
September 05, 2012, 01:33:50 AM
  • Registered User
  • *
  • Posts: 20
    • View Profile
Advertisement
/*
Write a C program that will accept an integer N as
input if and only if that integer N lies within 0-9999.
Then it will produce the summation of its digits and
lastly prints the integer as well as the summation.

*/

#include<stdio.h>?
#include<conio.h>
void main()
{
long int n,i,s=0;
clrscr();
printf("n enter ur number ;");
scanf("%ld",&n);
if((n>=0)&&(n<=9999))
{
for(i=0;i<=n;i++)
{
s=s+i;
}
printf("n the sum of %ld number is %ld",n,s);
}
else
{
printf("n sry ur number not lies within the limit");
}
getch();
}
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »


May 31, 2015, 05:45:08 AM
Reply #1
  • Registered User
  • *
  • Posts: 1
    • View Profile
Dear Friends,
The correct coding for calculate the numbers is;

#include<stdio.h>
#include<conio.h>
void main()
{
long int n,i,s=0;

printf("n enter ur number ;");
scanf("%ld",&n);
if((n>=0)&&(n<=9999))
{
while(n>0)
{
    s=s+n%10;
    n=n/10;
}

printf("n the sum of %ld number is %ld",n,s);
}
else
{
printf("n sry ur number not lies within the limit");
}
getch();
}
« Last Edit: January 01, 1970, 04:00:00 AM by Guest »
 

Related Topics

  Subject / Started by Replies Last post
26 Replies
13779 Views
Last post August 07, 2013, 10:16:10 AM
by prasadcaher
5 Replies
6566 Views
Last post August 03, 2011, 12:21:08 PM
by Ripan
1 Replies
445 Views
Last post August 24, 2009, 05:41:27 PM
by praveen
0 Replies
841 Views
Last post July 09, 2011, 07:32:40 PM
by Nihil
0 Replies
3416 Views
Last post August 03, 2011, 09:28:05 PM
by midhun
2 Replies
377 Views
Last post September 29, 2011, 02:28:23 PM
by skarmakar007
0 Replies
1043 Views
Last post September 05, 2012, 09:12:06 PM
by sainathan

* Search

* Subscribe to Forum

Enter your email address:

Advertisement