What input you will give to write a basic program to find prime numbers between 1 to 100 using if and else?

1 answer

Answer

1256627

2026-08-05 21:00

+ Follow

#include <iOStream> void main() { using namespace std; int num, rem, sum=0; //Declaring variables cout<<"Enter a number :"<<endl; cin>>num; //Loop to calculate the sum of the digits of the given number. while(num!=0) { rem=num%10; num=num/10; sum=sum+rem; } cout<<"Sum of the digits is "<<sum<<endl; cin.get(); }

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.